Skip to contentSkip to conversation

Add attribute multiple_mdev_support for mdev type-id

RFC PATCH Superseded Kirti Wankhede 3 participants 7 messages Sep 27, 2018 – Sep 28, 2018 KVM

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

RFC PATCH 1/1 Add attribute multiple_mdev_support 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 about the configuration supported by vendor driver.

To expose supported configuration, vendor driver should add 'multiple_mdev_support' attribute to type-id directory if vendor driver supports assigning multiple mdev devices of a particular type-id to one instance of user space application or a VM.

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

This is optional and readonly attribute.

---
 Documentation/ABI/testing/sysfs-bus-vfio-mdev | 13 +++++++++++++
 1 file changed, 13 insertions(+)
Documentation/ABI/testing/sysfs-bus-vfio-mdev +13 -0
index 452dbe39270e..69e1291479ce 100644
@@ -85,6 +85,19 @@ 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>/multiple_mdev_support
+Date:           September 2018
+Contact:        Kirti Wankhede <[email protected]>
+Description:
+		Reading this attribute will return 0 or 1. Returning 1 indicates
+		multiple mdev devices of a particular <type-id> assigned to one
+		User space application is supported by vendor driver. This is
+		optional and readonly attribute.
+Users:
+		Userspace applications interested in knowing if multiple mdev
+		devices of a particular <type-id> can be assigned to one
+		instance of application.
+
 What:           /sys/.../<device>/<UUID>/
 Date:           October 2016
 Contact:        Kirti Wankhede <[email protected]>
Signature · 1 line
2.7.0
#1 lore raw
Quoted 21 lines

From: Kirti Wankhede
Sent: Thursday, September 27, 2018 2:22 PM

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 about the configuration supported by vendor driver.

To expose supported configuration, vendor driver should add 'multiple_mdev_support' attribute to type-id directory if vendor driver supports assigning multiple mdev devices of a particular type-id to one instance of user space application or a VM.

Quoted 6 lines

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

This is optional and readonly attribute.

I didn't get what is the exact problem from above description. Isn't it the basic point behind mdev concept that parent driver can create multiple mdev instances on a physical device? VFIO usually doesn't care whether multiple devices (pci or mdev) are assigned to same process/VM or not. Can you give some example of actual problem behind this change?

Thanks
Kevin

Quoted 38 lines
---
 Documentation/ABI/testing/sysfs-bus-vfio-mdev | 13 +++++++++++++
 1 file changed, 13 insertions(+)
Documentation/ABI/testing/sysfs-bus-vfio-mdev +1 -0
index 452dbe39270e..69e1291479ce 100644
@@ -85,6 +85,19 @@ 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>/multiple_mdev_support

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

indicates

Documentation/ABI/testing/sysfs-bus-vfio-mdev +1 -0
+		multiple mdev devices of a particular <type-id> assigned to

one

Documentation/ABI/testing/sysfs-bus-vfio-mdev +4 -0
+		User space application is supported by vendor driver. This is
+		optional and readonly attribute.
+Users:
+		Userspace applications interested in knowing if multiple

mdev

Documentation/ABI/testing/sysfs-bus-vfio-mdev +3 -1
+		devices of a particular <type-id> can be assigned to one
+		instance of application.
+
 What:           /sys/.../<device>/<UUID>/
 Date:           October 2016
 Contact:        Kirti Wankhede <[email protected]>
--

2.7.0

#2 lore raw
Quoted 26 lines · Kevin
Quoted 26 lines

From: Kirti Wankhede
Sent: Thursday, September 27, 2018 2:22 PM

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 about the configuration supported by vendor driver.

To expose supported configuration, vendor driver should add 'multiple_mdev_support' attribute to type-id directory if vendor driver supports assigning multiple mdev devices of a particular type-id to one instance of user space application or a VM.

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

Quoted 7 lines
Quoted 1 line

This is optional and readonly attribute.

I didn't get what is the exact problem from above description. Isn't it the basic point behind mdev concept that parent driver can create multiple mdev instances on a physical device? VFIO usually doesn't care whether multiple devices (pci or mdev) are assigned to same process/VM or not. Can you give some example of actual problem behind this change?

The situation here is that mdev imposes no restrictions regarding how mdev devices can be used by the user. Multiple mdevs, regardless of type, can be combined and used in any way the user sees fit, at least that's the theory. However, in practice, certain vendor drivers impose a limitation that prevents multiple mdev devices from being used in the same VM. This is done by returning an error when the user attempts to open those additional devices. Now we're in the very predictable situation that we want to consider that some of the vendor's mdev types might be combined in the same userspace instance, while others still impose a restriction, and how can we optionally expose such per mdev type restrictions to the userspace so we have something better than "try it and see if it works".

The below proposal assumes that a single instance per VM is the norm and that we add something to the API to indicate multiple instances are supported. However, that's really never been the position of the mdev core, where there's no concept of limiting devices per user instance; it's a vendor driver restriction. So I think the question is then why should we burden vendor drivers who do not impose a restriction with an additional field? Does the below extension provide a better backwards compatibility scenario?

With the current code, I think it's reasonable for userspace to assume there are no mdev limits per userspace instance, those that exist are vendor specific. The below proposal is for an optional field, what does the management tool assume when it's not supplied? We have both cases currently, mdev devices that allow multiple instances per VM and those that do not, so I don't see that the user is more informed with this addition and no attempt is made here to synchronously update all drivers to expose this new attribute.

Does it make more sense then to add an attribute to expose the restriction rather than the lack of restriction. Perhaps something like "singleton_usage_restriction". Also if the type is meant to be a boolean, I think we have Y/N support for that in sysfs rather than using integers which raise the question what >1 implies.

Is there a more compelling backwards compatibility store for the below proposal than what I'm thinking? Thanks,

Alex

Quoted 38 lines
Quoted 37 lines
---
 Documentation/ABI/testing/sysfs-bus-vfio-mdev | 13 +++++++++++++
 1 file changed, 13 insertions(+)
Documentation/ABI/testing/sysfs-bus-vfio-mdev +1 -0
index 452dbe39270e..69e1291479ce 100644
@@ -85,6 +85,19 @@ 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>/multiple_mdev_support

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

indicates

Documentation/ABI/testing/sysfs-bus-vfio-mdev +1 -0
+		multiple mdev devices of a particular <type-id> assigned to

one

Documentation/ABI/testing/sysfs-bus-vfio-mdev +4 -0
+		User space application is supported by vendor driver. This is
+		optional and readonly attribute.
+Users:
+		Userspace applications interested in knowing if multiple

mdev

Documentation/ABI/testing/sysfs-bus-vfio-mdev +3 -1
+		devices of a particular <type-id> can be assigned to one
+		instance of application.
+
 What:           /sys/.../<device>/<UUID>/
 Date:           October 2016
 Contact:        Kirti Wankhede <[email protected]>
--

2.7.0

#3 lore raw
Quoted 50 lines · Alex Williamson
Quoted 26 lines · Kevin
Quoted 26 lines

From: Kirti Wankhede
Sent: Thursday, September 27, 2018 2:22 PM

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 about the configuration supported by vendor driver.

To expose supported configuration, vendor driver should add 'multiple_mdev_support' attribute to type-id directory if vendor driver supports assigning multiple mdev devices of a particular type-id to one instance of user space application or a VM.

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

Quoted 7 lines
Quoted 1 line

This is optional and readonly attribute.

I didn't get what is the exact problem from above description. Isn't it the basic point behind mdev concept that parent driver can create multiple mdev instances on a physical device? VFIO usually doesn't care whether multiple devices (pci or mdev) are assigned to same process/VM or not. Can you give some example of actual problem behind this change?

The situation here is that mdev imposes no restrictions regarding how mdev devices can be used by the user. Multiple mdevs, regardless of type, can be combined and used in any way the user sees fit, at least that's the theory. However, in practice, certain vendor drivers impose a limitation that prevents multiple mdev devices from being used in the same VM. This is done by returning an error when the user attempts to open those additional devices. Now we're in the very predictable situation that we want to consider that some of the vendor's mdev types might be combined in the same userspace instance, while others still impose a restriction, and how can we optionally expose such per mdev type restrictions to the userspace so we have something better than "try it and see if it works".

Quoted 8 lines

The below proposal assumes that a single instance per VM is the norm and that we add something to the API to indicate multiple instances are supported. However, that's really never been the position of the mdev core, where there's no concept of limiting devices per user instance; it's a vendor driver restriction. So I think the question is then why should we burden vendor drivers who do not impose a restriction with an additional field? Does the below extension provide a better backwards compatibility scenario?

The vendor driver who do not want to impose restriction, doesn't need to provide this attribute. In that case, behavior would remain same as it is now, i.e. multiple mdev instances can be used by one instance of application.

Quoted 9 lines

With the current code, I think it's reasonable for userspace to assume there are no mdev limits per userspace instance, those that exist are vendor specific. The below proposal is for an optional field, what does the management tool assume when it's not supplied? We have both cases currently, mdev devices that allow multiple instances per VM and those that do not, so I don't see that the user is more informed with this addition and no attempt is made here to synchronously update all drivers to expose this new attribute.

When this attribute is not provided, behavior should remain same as it is now. But if this attribute is provided then management tool should read this attribute to verify that such combination is supported by vendor driver.

Quoted 3 lines

Does it make more sense then to add an attribute to expose the restriction rather than the lack of restriction. Perhaps something like "singleton_usage_restriction".

I would prefer to expose what is supported than what is restricted.

Quoted 4 lines

Also if the type is meant to be a
boolean, I think we have Y/N support for that in sysfs rather than using integers which raise the question what >1 implies.

Ok. Makes sense. I'll change it to Y/N

Thanks,
Kirti

Quoted 44 lines

Is there a more compelling backwards compatibility store for the below proposal than what I'm thinking? Thanks,

Alex

Quoted 38 lines
Quoted 37 lines
---
 Documentation/ABI/testing/sysfs-bus-vfio-mdev | 13 +++++++++++++
 1 file changed, 13 insertions(+)
Documentation/ABI/testing/sysfs-bus-vfio-mdev +1 -0
index 452dbe39270e..69e1291479ce 100644
@@ -85,6 +85,19 @@ 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>/multiple_mdev_support

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

indicates

Documentation/ABI/testing/sysfs-bus-vfio-mdev +1 -0
+		multiple mdev devices of a particular <type-id> assigned to

one

Documentation/ABI/testing/sysfs-bus-vfio-mdev +4 -0
+		User space application is supported by vendor driver. This is
+		optional and readonly attribute.
+Users:
+		Userspace applications interested in knowing if multiple

mdev

Documentation/ABI/testing/sysfs-bus-vfio-mdev +3 -1
+		devices of a particular <type-id> can be assigned to one
+		instance of application.
+
 What:           /sys/.../<device>/<UUID>/
 Date:           October 2016
 Contact:        Kirti Wankhede <[email protected]>
--

2.7.0

#4 lore raw
Quoted 81 lines · On Fri, 28 Sep 2018 00:53:00 +0530 Kirti Wankhede <[email protected]> wrote:
Quoted 50 lines · Alex Williamson
Quoted 26 lines · Kevin
Quoted 26 lines

From: Kirti Wankhede
Sent: Thursday, September 27, 2018 2:22 PM

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 about the configuration supported by vendor driver.

To expose supported configuration, vendor driver should add 'multiple_mdev_support' attribute to type-id directory if vendor driver supports assigning multiple mdev devices of a particular type-id to one instance of user space application or a VM.

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

Quoted 7 lines
Quoted 1 line

This is optional and readonly attribute.

I didn't get what is the exact problem from above description. Isn't it the basic point behind mdev concept that parent driver can create multiple mdev instances on a physical device? VFIO usually doesn't care whether multiple devices (pci or mdev) are assigned to same process/VM or not. Can you give some example of actual problem behind this change?

The situation here is that mdev imposes no restrictions regarding how mdev devices can be used by the user. Multiple mdevs, regardless of type, can be combined and used in any way the user sees fit, at least that's the theory. However, in practice, certain vendor drivers impose a limitation that prevents multiple mdev devices from being used in the same VM. This is done by returning an error when the user attempts to open those additional devices. Now we're in the very predictable situation that we want to consider that some of the vendor's mdev types might be combined in the same userspace instance, while others still impose a restriction, and how can we optionally expose such per mdev type restrictions to the userspace so we have something better than "try it and see if it works".

Quoted 8 lines

The below proposal assumes that a single instance per VM is the norm and that we add something to the API to indicate multiple instances are supported. However, that's really never been the position of the mdev core, where there's no concept of limiting devices per user instance; it's a vendor driver restriction. So I think the question is then why should we burden vendor drivers who do not impose a restriction with an additional field? Does the below extension provide a better backwards compatibility scenario?

The vendor driver who do not want to impose restriction, doesn't need to provide this attribute. In that case, behavior would remain same as it is now, i.e. multiple mdev instances can be used by one instance of application.

Quoted 9 lines

With the current code, I think it's reasonable for userspace to assume there are no mdev limits per userspace instance, those that exist are vendor specific. The below proposal is for an optional field, what does the management tool assume when it's not supplied? We have both cases currently, mdev devices that allow multiple instances per VM and those that do not, so I don't see that the user is more informed with this addition and no attempt is made here to synchronously update all drivers to expose this new attribute.

When this attribute is not provided, behavior should remain same as it is now. But if this attribute is provided then management tool should read this attribute to verify that such combination is supported by vendor driver.

Quoted 5 lines
Quoted 3 lines

Does it make more sense then to add an attribute to expose the restriction rather than the lack of restriction. Perhaps something like "singleton_usage_restriction".

I would prefer to expose what is supported than what is restricted.

Above, it's stated that vendors who do not impose a restriction do not need to implement this. So it's designed to expose a restriction. We're stating that exposing multiple_mdev_support=1/Y is the equivalent of not reporting the attribute at all, so the only reason to implement it would be because there is a restriction. So why masquerade as a feature? Thanks,

Alex

Quoted 54 lines
Quoted 4 lines

Also if the type is meant to be a
boolean, I think we have Y/N support for that in sysfs rather than using integers which raise the question what >1 implies.

Ok. Makes sense. I'll change it to Y/N

Thanks,
Kirti

Quoted 44 lines

Is there a more compelling backwards compatibility store for the below proposal than what I'm thinking? Thanks,

Alex

Quoted 38 lines
Quoted 37 lines
---
 Documentation/ABI/testing/sysfs-bus-vfio-mdev | 13 +++++++++++++
 1 file changed, 13 insertions(+)
Documentation/ABI/testing/sysfs-bus-vfio-mdev +1 -0
index 452dbe39270e..69e1291479ce 100644
@@ -85,6 +85,19 @@ 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>/multiple_mdev_support

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

indicates

Documentation/ABI/testing/sysfs-bus-vfio-mdev +1 -0
+		multiple mdev devices of a particular <type-id> assigned to

one

Documentation/ABI/testing/sysfs-bus-vfio-mdev +4 -0
+		User space application is supported by vendor driver. This is
+		optional and readonly attribute.
+Users:
+		Userspace applications interested in knowing if multiple

mdev

Documentation/ABI/testing/sysfs-bus-vfio-mdev +3 -1
+		devices of a particular <type-id> can be assigned to one
+		instance of application.
+
 What:           /sys/.../<device>/<UUID>/
 Date:           October 2016
 Contact:        Kirti Wankhede <[email protected]>
--

2.7.0

#5 lore raw
Quoted 106 lines

From: Alex Williamson [mailto:[email protected]]
Sent: Friday, September 28, 2018 4:01 AM

Quoted 8 lines · On Fri, 28 Sep 2018 00:53:00 +0530 Kirti Wankhede <[email protected]> wrote:
Quoted 7 lines · Alex Williamson
Quoted 4 lines · Kevin
Quoted 4 lines

From: Kirti Wankhede
Sent: Thursday, September 27, 2018 2:22 PM

Generally a single instance of mdev device, a share of physical device,

is

Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

assigned to user space application or a VM. There are cases when

multiple

Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

instances of mdev devices of same or different types are required by

User

Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines

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

Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines

application or VM.

All types of mdev devices may not support assigning multiple mdev

devices

Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 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

Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines

about the configuration supported by vendor driver.

To expose supported configuration, vendor driver should add 'multiple_mdev_support' attribute to type-id directory if vendor

driver

Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

supports assigning multiple mdev devices of a particular type-id to

one

Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines

instance of user space application or a VM.

User space application should read if 'multiple_mdev_support'

attibute is

Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines

present in type-id directory of all mdev devices which are going to be used. If all read 1 then user space application can proceed with

multiple

Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
Quoted 3 lines

mdev devices.

This is optional and readonly attribute.

I didn't get what is the exact problem from above description. Isn't it

the

Quoted 2 lines
Quoted 2 lines
Quoted 2 lines

basic point behind mdev concept that parent driver can create multiple mdev instances on a physical device? VFIO usually doesn't care

whether

Quoted 11 lines
Quoted 11 lines
Quoted 2 lines

multiple devices (pci or mdev) are assigned to same process/VM or not. Can you give some example of actual problem behind this change?

The situation here is that mdev imposes no restrictions regarding how mdev devices can be used by the user. Multiple mdevs, regardless of type, can be combined and used in any way the user sees fit, at least that's the theory. However, in practice, certain vendor drivers impose a limitation that prevents multiple mdev devices from being used in the same VM. This is done by returning an error when the user attempts to open those additional devices. Now we're in the very predictable situation that we want to consider that some of the vendor's mdev

types

Quoted 11 lines
Quoted 11 lines

might be combined in the same userspace instance, while others still impose a restriction, and how can we optionally expose such per mdev type restrictions to the userspace so we have something better than "try it and see if it works".

The below proposal assumes that a single instance per VM is the norm and that we add something to the API to indicate multiple instances are supported. However, that's really never been the position of the mdev core, where there's no concept of limiting devices per user instance; it's a vendor driver restriction. So I think the question is then why should we burden vendor drivers who do not impose a restriction with

an

Quoted 13 lines
Quoted 2 lines

additional field? Does the below extension provide a better backwards compatibility scenario?

The vendor driver who do not want to impose restriction, doesn't need to provide this attribute. In that case, behavior would remain same as it is now, i.e. multiple mdev instances can be used by one instance of application.

Quoted 4 lines

With the current code, I think it's reasonable for userspace to assume there are no mdev limits per userspace instance, those that exist are vendor specific. The below proposal is for an optional field, what does the management tool assume when it's not supplied? We have

both

Quoted 15 lines
Quoted 5 lines

cases currently, mdev devices that allow multiple instances per VM and those that do not, so I don't see that the user is more informed with this addition and no attempt is made here to synchronously update all drivers to expose this new attribute.

When this attribute is not provided, behavior should remain same as it is now. But if this attribute is provided then management tool should read this attribute to verify that such combination is supported by vendor driver.

Quoted 3 lines

Does it make more sense then to add an attribute to expose the restriction rather than the lack of restriction. Perhaps something like "singleton_usage_restriction".

Quoted 9 lines
Quoted 1 line

I would prefer to expose what is supported than what is restricted.

Above, it's stated that vendors who do not impose a restriction do not need to implement this. So it's designed to expose a restriction. We're stating that exposing multiple_mdev_support=1/Y is the equivalent of not reporting the attribute at all, so the only reason to implement it would be because there is a restriction. So why masquerade as a feature? Thanks,

Agree it looks more like a restriction than feature. Especially a natural thought of missing a feature knob means no support of the feature, which doesn't fit the intention here. Also what default behavior should high level mgmt.. stack assume if the attribute is missing? some vendor drivers allows while other doesn't today. Then do we ask to include vendor-specific knowledge for "remain same behavior"?

Thanks
Kevin

#6 lore raw
In reply to Alex Williamson
Quoted 136 lines

From: Tian, Kevin
Sent: Friday, September 28, 2018 9:27 AM

Quoted 14 lines

From: Alex Williamson [mailto:[email protected]]
Sent: Friday, September 28, 2018 4:01 AM

Quoted 8 lines · On Fri, 28 Sep 2018 00:53:00 +0530 Kirti Wankhede <[email protected]> wrote:
Quoted 7 lines · Alex Williamson
Quoted 4 lines · Kevin
Quoted 4 lines

From: Kirti Wankhede
Sent: Thursday, September 27, 2018 2:22 PM

Generally a single instance of mdev device, a share of physical

device,

Quoted 4 lines

is

Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

assigned to user space application or a VM. There are cases when

multiple

Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

instances of mdev devices of same or different types are required

by

Quoted 2 lines

User

Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

space application or VM. For example in case of vGPU, multiple

mdev

Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines

devices
of type which represents whole GPU can be assigned to one

instance

Quoted 12 lines

of

Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines

application or VM.

All types of mdev devices may not support assigning multiple mdev

devices

Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 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

Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines

about the configuration supported by vendor driver.

To expose supported configuration, vendor driver should add 'multiple_mdev_support' attribute to type-id directory if vendor

Quoted 8 lines

driver

Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

supports assigning multiple mdev devices of a particular type-id to

one

Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines

instance of user space application or a VM.

User space application should read if 'multiple_mdev_support'

attibute is

Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

present in type-id directory of all mdev devices which are going to

be

Quoted 9 lines
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

used. If all read 1 then user space application can proceed with

multiple

Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
Quoted 3 lines

mdev devices.

This is optional and readonly attribute.

I didn't get what is the exact problem from above description. Isn't it

the

Quoted 1 line
Quoted 1 line
Quoted 1 line

basic point behind mdev concept that parent driver can create

multiple

Quoted 3 lines
Quoted 1 line
Quoted 1 line
Quoted 1 line

mdev instances on a physical device? VFIO usually doesn't care

whether

Quoted 1 line
Quoted 1 line
Quoted 1 line

multiple devices (pci or mdev) are assigned to same process/VM or

not.

Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
Quoted 1 line

Can you give some example of actual problem behind this change?

The situation here is that mdev imposes no restrictions regarding how mdev devices can be used by the user. Multiple mdevs, regardless of type, can be combined and used in any way the user sees fit, at least that's the theory. However, in practice, certain vendor drivers impose a limitation that prevents multiple mdev devices from being used in

the

Quoted 1 line
Quoted 1 line
Quoted 1 line

same VM. This is done by returning an error when the user attempts

to

Quoted 5 lines
Quoted 2 lines
Quoted 2 lines

open those additional devices. Now we're in the very predictable situation that we want to consider that some of the vendor's mdev

types

Quoted 2 lines
Quoted 2 lines

might be combined in the same userspace instance, while others still impose a restriction, and how can we optionally expose such per

mdev

Quoted 4 lines
Quoted 4 lines
Quoted 4 lines

type restrictions to the userspace so we have something better than "try it and see if it works".

The below proposal assumes that a single instance per VM is the

norm

Quoted 1 line
Quoted 1 line
Quoted 1 line

and that we add something to the API to indicate multiple instances

are

Quoted 1 line
Quoted 1 line
Quoted 1 line

supported. However, that's really never been the position of the

mdev

Quoted 3 lines
Quoted 3 lines
Quoted 3 lines

core, where there's no concept of limiting devices per user instance; it's a vendor driver restriction. So I think the question is then why should we burden vendor drivers who do not impose a restriction

with

Quoted 2 lines

an

Quoted 1 line
Quoted 1 line

additional field? Does the below extension provide a better

backwards

Quoted 3 lines
Quoted 3 lines
Quoted 1 line

compatibility scenario?

The vendor driver who do not want to impose restriction, doesn't need

to

Quoted 11 lines
Quoted 9 lines

provide this attribute. In that case, behavior would remain same as it is now, i.e. multiple mdev instances can be used by one instance of application.

Quoted 4 lines

With the current code, I think it's reasonable for userspace to assume there are no mdev limits per userspace instance, those that exist are vendor specific. The below proposal is for an optional field, what does the management tool assume when it's not supplied? We have

both

Quoted 1 line
Quoted 1 line

cases currently, mdev devices that allow multiple instances per VM

and

Quoted 14 lines
Quoted 14 lines
Quoted 4 lines

those that do not, so I don't see that the user is more informed with this addition and no attempt is made here to synchronously update all drivers to expose this new attribute.

When this attribute is not provided, behavior should remain same as it is now. But if this attribute is provided then management tool should read this attribute to verify that such combination is supported by vendor driver.

Quoted 3 lines

Does it make more sense then to add an attribute to expose the restriction rather than the lack of restriction. Perhaps something like "singleton_usage_restriction".

Quoted 9 lines
Quoted 1 line

I would prefer to expose what is supported than what is restricted.

Above, it's stated that vendors who do not impose a restriction do not need to implement this. So it's designed to expose a restriction. We're stating that exposing multiple_mdev_support=1/Y is the equivalent of not reporting the attribute at all, so the only reason to implement it would be because there is a restriction. So why masquerade as a feature? Thanks,

Quoted 7 lines

Agree it looks more like a restriction than feature. Especially a natural thought
of missing a feature knob means no support of the feature, which doesn't fit the intention here. Also what default behavior should high level mgmt.. stack assume if the attribute is missing? some vendor drivers allows while other doesn't today. Then do we ask to include vendor-specific knowledge for "remain same behavior"?

forgot the latter part. Just realized Alex already explained the current behavior - "try it and see if it works". :-)

Thanks
Kevin