Skip to contentSkip to conversation

Add attribute single_usage_restriction for mdev type-id

PATCH In review Kirti Wankhede 5 participants 6 messages Oct 8, 2018 – Oct 17, 2018 KVM

lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 Add attribute single_usage_restriction for mdev type-id

Generally a single instance of mdev device, a share of physical device, is assigned to user space application or a VM. There are cases when multiple instances of mdev devices of same or different types are required by user space application or VM. For example in case of vGPU, multiple mdev devices of type which represents whole GPU can be assigned to one instance of application or VM.

All types of mdev devices may not support assigning multiple mdev devices to a user space application. In that case vendor driver can fail open() call of mdev device. But there is no way to know User space application to about the configuration supported by vendor driver.

To expose supported configuration, vendor driver should add 'single_usage_restriction' attribute to type-id directory. Returning Y for this attribute indicates vendor driver has restriction of single mdev device of particular <type-id> assigned to one user space application. Returning N indicates that multiple mdev devices of particular <type-id> can be assigned to one user space application.

User space application should read if 'single_usage_restriction' attibute is present in <type-id> directory of all mdev devices which are going to be used. If all read N then user space application can proceed with multiple mdev devices.

This is optional and readonly attribute.

---
 Documentation/ABI/testing/sysfs-bus-vfio-mdev | 16 ++++++++++++++++
 1 file changed, 16 insertions(+)
Documentation/ABI/testing/sysfs-bus-vfio-mdev +16 -0
index 452dbe39270e..3aca352a70e5 100644
@@ -85,6 +85,22 @@ Users:
 		a particular <type-id> that can help in understanding the
 		features provided by that type of mediated device.
 
+What:		/sys/.../mdev_supported_types/<type-id>/single_usage_restriction
+Date:           October 2018
+Contact:        Kirti Wankhede <[email protected]>
+Description:
+		Reading this attribute will return Y or N. Returning Y indicates
+		vendor driver has restriction of single mdev device of this
+		particular <type-id> assigned to one user space application.
+		Returning N indicates that multiple mdev devices of particular
+		<type-id> can be assigned to one user space application.
+		This is optional and readonly attribute.
+Users:
+		User space application should read if 'single_usage_restriction'
+		attibute is present in <type-id> directory of all mdev devices
+		which are going to be used. If all read N then user space
+		application can proceed with multiple mdev devices.
+
 What:           /sys/.../<device>/<UUID>/
 Date:           October 2016
 Contact:        Kirti Wankhede <[email protected]>
Signature · 1 line
2.7.0
#1 lore raw
Quoted 45 lines · On Tue, 9 Oct 2018 01:40:17 +0530 Kirti Wankhede <[email protected]> wrote:

Generally a single instance of mdev device, a share of physical device, is assigned to user space application or a VM. There are cases when multiple instances of mdev devices of same or different types are required by user space application or VM. For example in case of vGPU, multiple mdev devices of type which represents whole GPU can be assigned to one instance of application or VM.

All types of mdev devices may not support assigning multiple mdev devices to a user space application. In that case vendor driver can fail open() call of mdev device. But there is no way to know User space application to about the configuration supported by vendor driver.

To expose supported configuration, vendor driver should add 'single_usage_restriction' attribute to type-id directory. Returning Y for this attribute indicates vendor driver has restriction of single mdev device of particular <type-id> assigned to one user space application. Returning N indicates that multiple mdev devices of particular <type-id> can be assigned to one user space application.

User space application should read if 'single_usage_restriction' attibute is present in <type-id> directory of all mdev devices which are going to be used. If all read N then user space application can proceed with multiple mdev devices.

This is optional and readonly attribute.

---
 Documentation/ABI/testing/sysfs-bus-vfio-mdev | 16 ++++++++++++++++
 1 file changed, 16 insertions(+)
Documentation/ABI/testing/sysfs-bus-vfio-mdev +5 -0
index 452dbe39270e..3aca352a70e5 100644
@@ -85,6 +85,22 @@ Users:
 		a particular <type-id> that can help in understanding the
 		features provided by that type of mediated device.
 
+What:		/sys/.../mdev_supported_types/<type-id>/single_usage_restriction
+Date:           October 2018
+Contact:        Kirti Wankhede <[email protected]>
+Description:
+		Reading this attribute will return Y or N. Returning Y indicates

Documentation/ABI/testing/sysfs-bus-vfio-mdev Users: · line 102

Quoted 10 lines
Documentation/ABI/testing/sysfs-bus-vfio-mdev +10 -0
+		vendor driver has restriction of single mdev device of this
+		particular <type-id> assigned to one user space application.
+		Returning N indicates that multiple mdev devices of particular
+		<type-id> can be assigned to one user space application.
+		This is optional and readonly attribute.
+Users:
+		User space application should read if 'single_usage_restriction'
+		attibute is present in <type-id> directory of all mdev devices
+		which are going to be used. If all read N then user space
+		application can proceed with multiple mdev devices.

But we don't say what userspace should do when this optional attribute is not present. Do we know of any cases other than the NVIDIA GRID vGPU drivers that have this restriction? Intel folks, are multiple GVT-g mdevs currently allowed in a VM? I don't think the libvirt algorithm is going to be as simple as suggested here and we should probably understand what it really needs to be.

There's also a scope issue that's unclear here, the verbiage above suggests that I can't combine a 'single_usage_restriction=Y' mdev with any other mdev, but clearly there's no dependency between adding both an NVIDIA and Intel vGPU to the same VM, right? Or NVIDIA and any of the mdev sample drivers. The restriction is across mdev types and parent devices in this case, but I think it stops at the vendor driver, right? How do we make that more clear, both in wording and perhaps implicit in the attribute itself? Thanks,

Alex

#2 lore raw
Quoted 66 lines

From: Alex Williamson
Sent: Thursday, October 11, 2018 4:39 AM

Quoted 2 lines · On Tue, 9 Oct 2018 01:40:17 +0530 Kirti Wankhede <[email protected]> wrote:

Generally a single instance of mdev device, a share of physical device, is assigned to user space application or a VM. There are cases when

multiple

Quoted 2 lines

instances of mdev devices of same or different types are required by user space application or VM. For example in case of vGPU, multiple mdev

devices

Quoted 4 lines

of type which represents whole GPU can be assigned to one instance of application or VM.

All types of mdev devices may not support assigning multiple mdev

devices

Quoted 18 lines

to a user space application. In that case vendor driver can fail open() call of mdev device. But there is no way to know User space application to about the configuration supported by vendor driver.

To expose supported configuration, vendor driver should add 'single_usage_restriction' attribute to type-id directory. Returning Y for this attribute indicates vendor driver has restriction of single mdev device of particular <type-id> assigned to one user space application. Returning N indicates that multiple mdev devices of particular <type-id> can be assigned to one user space application.

User space application should read if 'single_usage_restriction' attibute is present in <type-id> directory of all mdev devices which are going to be used. If all read N then user space application can proceed with multiple mdev devices.

This is optional and readonly attribute.

Review

Quoted 7 lines
---
 Documentation/ABI/testing/sysfs-bus-vfio-mdev | 16 ++++++++++++++++
 1 file changed, 16 insertions(+)
(quoted diff) +0 -0

b/Documentation/ABI/testing/sysfs-bus-vfio-mdev

Documentation/ABI/testing/sysfs-bus-vfio-mdev Users: · line 88

Quoted 8 lines

index 452dbe39270e..3aca352a70e5 100644

Documentation/ABI/testing/sysfs-bus-vfio-mdev +1 -0
@@ -85,6 +85,22 @@ Users:
 		a particular <type-id> that can help in understanding the
 		features provided by that type of mediated device.
 
+What:		/sys/.../mdev_supported_types/<type-

id>/single_usage_restriction

Documentation/ABI/testing/sysfs-bus-vfio-mdev Users:

Quoted 4 lines
Documentation/ABI/testing/sysfs-bus-vfio-mdev +4 -0
+Date:           October 2018
+Contact:        Kirti Wankhede <[email protected]>
+Description:
+		Reading this attribute will return Y or N. Returning Y

indicates

Documentation/ABI/testing/sysfs-bus-vfio-mdev Users:

Quoted 3 lines
Documentation/ABI/testing/sysfs-bus-vfio-mdev +3 -0
+		vendor driver has restriction of single mdev device of this
+		particular <type-id> assigned to one user space application.
+		Returning N indicates that multiple mdev devices of

particular

Documentation/ABI/testing/sysfs-bus-vfio-mdev Users:

Quoted 4 lines
Documentation/ABI/testing/sysfs-bus-vfio-mdev +4 -0
+		<type-id> can be assigned to one user space application.
+		This is optional and readonly attribute.
+Users:
+		User space application should read if

'single_usage_restriction'

Quoted 10 lines

Documentation/ABI/testing/sysfs-bus-vfio-mdev Users: · line 102

Quoted 3 lines
Documentation/ABI/testing/sysfs-bus-vfio-mdev +3 -0
+		attibute is present in <type-id> directory of all mdev devices
+		which are going to be used. If all read N then user space
+		application can proceed with multiple mdev devices.

But we don't say what userspace should do when this optional attribute is not present. Do we know of any cases other than the NVIDIA GRID vGPU drivers that have this restriction? Intel folks, are multiple GVT-g mdevs currently allowed in a VM? I don't think the libvirt algorithm is going to be as simple as suggested here and we should probably understand what it really needs to be.

technically I don't see a restriction in GVT-g side, i.e. multiple GVT-g mdevs can be assigned to same VM. But the fact is that Intel GPU is integrated thus just one per platform. Then guest i915 driver may have problem to operate multiple vGPUs if with some assumption on integrated part. I don't think we verified such configuration. Zhenyu?

Quoted 11 lines

There's also a scope issue that's unclear here, the verbiage above suggests that I can't combine a 'single_usage_restriction=Y' mdev with any other mdev, but clearly there's no dependency between adding both an NVIDIA and Intel vGPU to the same VM, right? Or NVIDIA and any of the mdev sample drivers. The restriction is across mdev types and parent devices in this case, but I think it stops at the vendor driver, right? How do we make that more clear, both in wording and perhaps implicit in the attribute itself? Thanks,

Alex

#3 lore raw
Quoted 77 lines · Kevin
Quoted 66 lines

From: Alex Williamson
Sent: Thursday, October 11, 2018 4:39 AM

Quoted 2 lines · On Tue, 9 Oct 2018 01:40:17 +0530 Kirti Wankhede <[email protected]> wrote:

Generally a single instance of mdev device, a share of physical device, is assigned to user space application or a VM. There are cases when

multiple

Quoted 2 lines

instances of mdev devices of same or different types are required by user space application or VM. For example in case of vGPU, multiple mdev

devices

Quoted 4 lines

of type which represents whole GPU can be assigned to one instance of application or VM.

All types of mdev devices may not support assigning multiple mdev

devices

Quoted 18 lines

to a user space application. In that case vendor driver can fail open() call of mdev device. But there is no way to know User space application to about the configuration supported by vendor driver.

To expose supported configuration, vendor driver should add 'single_usage_restriction' attribute to type-id directory. Returning Y for this attribute indicates vendor driver has restriction of single mdev device of particular <type-id> assigned to one user space application. Returning N indicates that multiple mdev devices of particular <type-id> can be assigned to one user space application.

User space application should read if 'single_usage_restriction' attibute is present in <type-id> directory of all mdev devices which are going to be used. If all read N then user space application can proceed with multiple mdev devices.

This is optional and readonly attribute.

Review

Quoted 7 lines
---
 Documentation/ABI/testing/sysfs-bus-vfio-mdev | 16 ++++++++++++++++
 1 file changed, 16 insertions(+)
(quoted diff) +0 -0

b/Documentation/ABI/testing/sysfs-bus-vfio-mdev

Documentation/ABI/testing/sysfs-bus-vfio-mdev Users: · line 88

Quoted 8 lines

index 452dbe39270e..3aca352a70e5 100644

Documentation/ABI/testing/sysfs-bus-vfio-mdev +1 -0
@@ -85,6 +85,22 @@ Users:
 		a particular <type-id> that can help in understanding the
 		features provided by that type of mediated device.
 
+What:		/sys/.../mdev_supported_types/<type-

id>/single_usage_restriction

Documentation/ABI/testing/sysfs-bus-vfio-mdev Users:

Quoted 4 lines
Documentation/ABI/testing/sysfs-bus-vfio-mdev +4 -0
+Date:           October 2018
+Contact:        Kirti Wankhede <[email protected]>
+Description:
+		Reading this attribute will return Y or N. Returning Y

indicates

Documentation/ABI/testing/sysfs-bus-vfio-mdev Users:

Quoted 3 lines
Documentation/ABI/testing/sysfs-bus-vfio-mdev +3 -0
+		vendor driver has restriction of single mdev device of this
+		particular <type-id> assigned to one user space application.
+		Returning N indicates that multiple mdev devices of

particular

Documentation/ABI/testing/sysfs-bus-vfio-mdev Users:

Quoted 4 lines
Documentation/ABI/testing/sysfs-bus-vfio-mdev +4 -0
+		<type-id> can be assigned to one user space application.
+		This is optional and readonly attribute.
+Users:
+		User space application should read if

'single_usage_restriction'

Quoted 10 lines

Documentation/ABI/testing/sysfs-bus-vfio-mdev Users: · line 102

Quoted 3 lines
Documentation/ABI/testing/sysfs-bus-vfio-mdev +3 -0
+		attibute is present in <type-id> directory of all mdev devices
+		which are going to be used. If all read N then user space
+		application can proceed with multiple mdev devices.

But we don't say what userspace should do when this optional attribute is not present. Do we know of any cases other than the NVIDIA GRID vGPU drivers that have this restriction? Intel folks, are multiple GVT-g mdevs currently allowed in a VM? I don't think the libvirt algorithm is going to be as simple as suggested here and we should probably understand what it really needs to be.

Quoted 6 lines

technically I don't see a restriction in GVT-g side, i.e. multiple GVT-g mdevs can be assigned to same VM. But the fact is that Intel GPU is integrated thus just one per platform. Then guest i915 driver may have problem to operate multiple vGPUs if with some assumption on integrated part. I don't think we verified such configuration. Zhenyu?

yeah, as current intel gpu is single device, even guest i915 driver could operate but user space gfx driver is not ready for multiple devices, so won't be useful now.

Signature · 3 lines
Open Source Technology Center, Intel ltd.

$gpg --keyserver wwwkeys.pgp.net --recv-keys 4D781827
#4 lore raw
Quoted 85 lines · On Thu, 11 Oct 2018 09:14:22 +0800 Zhenyu Wang <[email protected]> wrote:
Quoted 77 lines · Kevin
Quoted 66 lines

From: Alex Williamson
Sent: Thursday, October 11, 2018 4:39 AM

Quoted 2 lines · On Tue, 9 Oct 2018 01:40:17 +0530 Kirti Wankhede <[email protected]> wrote:

Generally a single instance of mdev device, a share of physical device, is assigned to user space application or a VM. There are cases when

multiple

Quoted 2 lines

instances of mdev devices of same or different types are required by user space application or VM. For example in case of vGPU, multiple mdev

devices

Quoted 4 lines

of type which represents whole GPU can be assigned to one instance of application or VM.

All types of mdev devices may not support assigning multiple mdev

devices

Quoted 18 lines

to a user space application. In that case vendor driver can fail open() call of mdev device. But there is no way to know User space application to about the configuration supported by vendor driver.

To expose supported configuration, vendor driver should add 'single_usage_restriction' attribute to type-id directory. Returning Y for this attribute indicates vendor driver has restriction of single mdev device of particular <type-id> assigned to one user space application. Returning N indicates that multiple mdev devices of particular <type-id> can be assigned to one user space application.

User space application should read if 'single_usage_restriction' attibute is present in <type-id> directory of all mdev devices which are going to be used. If all read N then user space application can proceed with multiple mdev devices.

This is optional and readonly attribute.

Review

Quoted 7 lines
---
 Documentation/ABI/testing/sysfs-bus-vfio-mdev | 16 ++++++++++++++++
 1 file changed, 16 insertions(+)
(quoted diff) +0 -0

b/Documentation/ABI/testing/sysfs-bus-vfio-mdev

Documentation/ABI/testing/sysfs-bus-vfio-mdev Users: · line 88

Quoted 8 lines

index 452dbe39270e..3aca352a70e5 100644

Documentation/ABI/testing/sysfs-bus-vfio-mdev +1 -0
@@ -85,6 +85,22 @@ Users:
 		a particular <type-id> that can help in understanding the
 		features provided by that type of mediated device.
 
+What:		/sys/.../mdev_supported_types/<type-

id>/single_usage_restriction

Documentation/ABI/testing/sysfs-bus-vfio-mdev Users:

Quoted 4 lines
Documentation/ABI/testing/sysfs-bus-vfio-mdev +4 -0
+Date:           October 2018
+Contact:        Kirti Wankhede <[email protected]>
+Description:
+		Reading this attribute will return Y or N. Returning Y  

indicates

Documentation/ABI/testing/sysfs-bus-vfio-mdev Users:

Quoted 3 lines
Documentation/ABI/testing/sysfs-bus-vfio-mdev +3 -0
+		vendor driver has restriction of single mdev device of this
+		particular <type-id> assigned to one user space application.
+		Returning N indicates that multiple mdev devices of  

particular

Documentation/ABI/testing/sysfs-bus-vfio-mdev Users:

Quoted 4 lines
Documentation/ABI/testing/sysfs-bus-vfio-mdev +4 -0
+		<type-id> can be assigned to one user space application.
+		This is optional and readonly attribute.
+Users:
+		User space application should read if  

'single_usage_restriction'

Quoted 10 lines

Documentation/ABI/testing/sysfs-bus-vfio-mdev Users: · line 102

Quoted 3 lines
Documentation/ABI/testing/sysfs-bus-vfio-mdev +3 -0
+		attibute is present in <type-id> directory of all mdev devices
+		which are going to be used. If all read N then user space
+		application can proceed with multiple mdev devices.  

But we don't say what userspace should do when this optional attribute is not present. Do we know of any cases other than the NVIDIA GRID vGPU drivers that have this restriction? Intel folks, are multiple GVT-g mdevs currently allowed in a VM? I don't think the libvirt algorithm is going to be as simple as suggested here and we should probably understand what it really needs to be.

Quoted 6 lines

technically I don't see a restriction in GVT-g side, i.e. multiple GVT-g mdevs can be assigned to same VM. But the fact is that Intel GPU is integrated thus just one per platform. Then guest i915 driver may have problem to operate multiple vGPUs if with some assumption on integrated part. I don't think we verified such configuration. Zhenyu?

Quoted 3 lines

yeah, as current intel gpu is single device, even guest i915 driver could operate but user space gfx driver is not ready for multiple devices, so won't be useful now.

The restriction sounds different here though, in the case of NVIDIA it's the mdev vendor driver with the restriction, with Intel I think I'm hearing that it's the guest graphics driver that's the restriction. I don't think we'd want to place an artificial restriction at the mdev layer for a guest driver deficiency that could theoretically be fixed independently from the host mdev vendor driver. Thanks,

Alex