On Thu, Feb 27, 2020 at 6:29 PM Gerd Hoffmann <kraxel@xxxxxxxxxx> wrote: > > Hi, > > > Dmitry's virtio-video driver > > https://patchwork.linuxtv.org/patch/61717/. > > Once it becomes fully functional, I'll post a list of possible > > improvements of protocol. > > Cool. Actually implementing things can find design problems > in the protocol you didn't notice earlier. > > > > > +\begin{description} > > > > +\item[\field{version}] is the protocol version that the device talks. > > > > + The device MUST set this to 0. > > > > > > What is the intended use case for this? > > > > > > Given that virtio has feature flags to negotiate support for optional > > > features and protocol extensions between driver and device, why do you > > > think this is needed? > > > > While feature flags work well when we "extend" the protocol with an > > optional feature, they don't when we want to "drop" or "modify" > > features. > > For example, I guess it'd be useful when we want: > > * to abandon a non-optional command, > > * to change a non-optional struct's layout,or > > * to change the order of commands in which the device expects to be sent. > > > > Though it might be possible to handle these changes by feature flags, > > I suspect the version number allow us to transition protocols more > > smoothly. > > Feature flags can be mandatory, both device and driver can fail > initialization when a specific feature is not supported by the other > end. So in case we did screw up things so badly that we have to > effectively start over (which I hope wouldn't be the case) we can add a > VERSION_2 feature flag for a new set of commands with new structs and > new semantics. > > With a feature flag both driver and device can choose whenever they want > support v1 or v2 or both. With a version config field this is more > limited, the device can't decide to support both. So the bonus points > for a smooth transition go to the feature flags not the version field ;) I agree that feature flags would be preferable in general, but I'm concerned by the fact that there is (IIUC) a limited number of them. Video tends to change significantly over time, and to have optional features that would also be presented as feature flags. After a while we may run out of them, while a new protocol version would allow us to extend the config struct with some new flags. Or am I missing something? I also wonder how "support v1 or v2 or both" would work with feature flags. In order to make it possible to opt out of v1, I guess we would need "v1 supported" flag to begin with? Sorry for the newbie question about feature flags, I'm still in the process of wrapping my head around virtio. :)