Re: [PATCH 1/2] vhost: add ioctl to query nregions upper limit

Michael S. Tsirkin
2015-07-29T15:23:09Z

On Wed, Jul 29, 2015 at 05:01:43PM +0200, Paolo Bonzini wrote:
>
>
> On 29/07/2015 16:56, Michael S. Tsirkin wrote:
> >>>> > > > Also, document our contract with legacy userspace: when running on an
> >>>> > > > old kernel, you get -1 and you can assume at least 64 slots. Since 0
> >>>> > > > value's left unused, let's make that mean that the current userspace
> >>>> > > > behaviour (trial and error) is required, just in case we want it back.
> >>> > >
> >>> > > What's wrong with reading the module parameter value? It's there in
> >>> > > sysfs ...
> >> > for most cases it would work but distro doesn't have to mount
> >> > sysfs under /sys
> > If it wants to rewrite all userspace, sure it doesn't.
>
> I agree, on the other hand it doesn't seem far fetched to have a per-fd
> maximum in the future. So I think this patch is more future-proof.
>
> Paolo

Possibly, but this calls for some kind of priveledge separation model,
where a priveledged app can set the per-fd limit while regular ones
can only read it. Sounds very complex. Let's see some of this code
first.

And I really think there are better ways to future proof it, e.g. teach
userspace to do error handling, revert adding a slot if one of the
components can't support it.

--
MST