Re: [RFC PATCH 3/8] qaic: Create char dev

From: Greg KH
Date: Sun May 17 2020 - 03:14:30 EST


On Sat, May 16, 2020 at 03:29:19PM -0600, Jeffrey Hugo wrote:
> On 5/16/2020 1:01 AM, Greg KH wrote:
> > On Fri, May 15, 2020 at 03:08:59PM -0600, Jeffrey Hugo wrote:
> > > 2. There are a limited number of dynamic minor numbers for misc devs (64),
> > > so if you are expecting more devices than that, a misc dev is not
> > > appropiate. Also, these minors are shared with other misc dev users, so
> > > depending on the system configuration, you might have significantly less
> > > than 64 minors available for use.
> >
> > I'm pretty sure we can have more than 64 misc devices, that limitation
> > should have been removed a while ago. Try it and see :)
>
> In total, there can be more tha 64 misc devices. However my previous
> comment was specific to dynamic minors (ie devices which do not have an
> assigned minor). The limit on dynamic minors still apears to be 64. Looking
> at the code -
>
> DYNAMIC_MINORS is still 64
> https://elixir.bootlin.com/linux/v5.7-rc5/source/drivers/char/misc.c#L63
>
> I see the same in -next
>
> DYNAMIC_MINORS is used to size a bitmap - one bit for each dynamic minor
> misc device that exists at one particular point in time. After all 64 bits
> are consumed by misc_register() by clients requesting a dynamic minor, no
> more dynamic minor misc devices can be registered until some are
> unregistered.
>
> What am I missing?

Oops, nothing, my fault. We fixed up the allocation of more dynamic
majors for chardev in 2017 and for some reason I thought we also
increased the number of misc dynamic minors at the same time, but that
was incorrect.

I'll gladly take patches that bump up the number of misc minors if
needed.

But to get back to the main issue here, you are only going to have 1 or
maybe 2 of these devices in a system at a time, right? So "burning" a
whole major number for that feels like a waste.

thanks,

greg k-h