On Tue, 20 Sep 2016 20:05:01 +0530
Kirti Wankhede <kwankhede(a)nvidia.com> wrote:
On 9/20/2016 3:55 AM, Alex Williamson wrote:
> On Mon, 19 Sep 2016 23:50:56 +0200
> Paolo Bonzini <pbonzini(a)redhat.com> wrote:
>
>> On 19/09/2016 23:36, Alex Williamson wrote:
>>> On Tue, 20 Sep 2016 02:05:52 +0530
>>> Kirti Wankhede <kwankhede(a)nvidia.com> wrote:
>>>> 'fb_length':
>>>> Read-only file. Mandatory.
>>>> Returns <number>{K,M,G}, size of framebuffer.
>>>
>>> This can't be mandatory, it's only relevant to vGPU devices, vGPUs
are
>>> just one user of mediated devices. [...]
>>>
>>>> 'params'
>>>> Write-Only file. Optional.
>>>> String input. Libvirt would pass the string given in XML file to
>>>> this file and then create mdev device. Set empty string to clear
params.
>>>> For example, set parameter 'frame_rate_limiter=0' to disable
frame rate
>>>> limiter for performance benchmarking, then create device of type 11.
The
>>>> device created would have that parameter set by vendor driver.
>>>
>>> Might as well just call it "magic", there's absolutely no
ability to
>>> introspect what parameters are allowed or even valid here. Can all
>>> parameters be changed dynamically? Do parameter changes apply to
>>> existing devices or only future devices? This is a poorly specified
>>> interface. I'd prefer this be done via module options on the vendor
>>> driver.
>>
>> Or additional files in the mdev's sysfs directory?
>
> Sure, the vendor driver could certainly support that, it'd be vendor
> specific of course.
>
Right, it would be vendor specific. But if this is not set through mdev
device XML, user have to create mdev device with XML first and then
manually set such parameter. Also these parameters would not retain if
mdev device is destroyed and created again. That's why if libvirt sets
these parameters by reading it from XML file, it would be simple for user.
If we move 'params' file to mdev device, could libvirt do the following
to create mdev device:
* Read /sys/../0000\:86\:00.0/11/max_instances. If it is greater than 0,
then only proceed else fail.
* Autogenerate UUID
* Create device:
echo "$UUID" > /sys/../0000\:86\:00.0/11/create
* Set extra params if 'params' field exist in device XML and 'params'
file exist mdev device directory:
echo "frame_rate_limiter=0" > /sys/bus/mdev/devices/$UUID/params
Why does libvirt even need to participate in setting these additional
parameters? The example here is for benchmarking, which doesn't
express to me a strong need to be automated through libvirt. For
hostdev devices libvirt supports a managed='no' option that requires
the user to setup the device in advance. Something similar sounds
reasonable here too.
This is also where I see that a vendor module option could be used,
something like:
modprobe nvidia enable-no-frl-mdev
You say you don't want to apply this to all mdev devices, but maybe it
just makes an additional type-id available "GRID-M60-0B-NOFRL". Then
you've removed libvirt from the equation, the VM simply specifies this
type-id that incorporates that feature. Obviously it gets complicated
if there are multiple features to enable, but we've only seen one
example so far of why this parameter is needed. Thanks,
Alex