dri-devel.lists.freedesktop.org archive mirror
 help / color / mirror / Atom feed
From: Simon Ser <contact@emersion.fr>
To: "Michał Winiarski" <michal.winiarski@intel.com>
Cc: Thomas Zimmermann <tzimmermann@suse.de>,
	DRI Development <dri-devel@lists.freedesktop.org>
Subject: Re: [PATCH 0/3] drm: Use full allocated minor range for DRM
Date: Fri, 19 Aug 2022 08:16:07 +0000	[thread overview]
Message-ID: <QfMoMae4qM8am6w1mha9iE_XrkqBLaR3r0gaT8oxaXDgysa0_8Si7kQuirRgJ-x_4YPILalQsNJKJqyi5ZDScnPUv65cPwd0y3di5Dntmrw=@emersion.fr> (raw)
In-Reply-To: <20220818120616.xuhlnsckjd4octwb@nostramo.hardline.pl>

(It seems like the list was dropped in my reply, sorry about that.
Re-adding it now.)

On Thursday, August 18th, 2022 at 14:06, Michał Winiarski <michal.winiarski@intel.com> wrote:

> On Thu, Aug 18, 2022 at 07:39:13AM +0000, Simon Ser wrote:
> 
> > Hm, I'm a bit worried about the user-space implications of this… e.g. libdrm
> > can check for the major/minor to find out the type of a node. Dropping CONTROL
> > from the enum will break that.
> 
> Yeah, but that would only cause problems if there are more than 64 devices in
> the system, and the user-space in question is smart enough to support that.
> 
> IIUC libdrm only looks for 16 devices:
> https://gitlab.freedesktop.org/mesa/drm/-/blob/main/xf86drm.h#L47
> 
> I'm not very familiar with mesa codebase, but I think it has something similar:
> https://gitlab.freedesktop.org/mesa/mesa/-/blob/main/src/gallium/auxiliary/pipe-loader/pipe_loader_drm.c#L52
> 
> I expect other clients to also have something similar (loop over minors, 0-63
> for primary, 128-191 for render).
> 
> So this shouldn't really cause a regression, it's just that "old" userspace
> won't be able to use more devices (but it's also not able to use more devices
> without this series).

Unfortunately I think there are more assumptions all over the place, see e.g.
drmGetMinorType:
https://gitlab.freedesktop.org/mesa/drm/-/blob/main/xf86drm.c#L986

Also I'm not very found of dropping DRM_NODE_CONTROL from the kernel enum --
this results in DRM_NODE_RENDER=1 in the kernel but DRM_NODE_RENDER=2 in
user-space which sounds pretty error-prone.

> I could go with 0-63 primary, 64-127 empty, 128-191 render, 192-255 primary,
> 256-319 empty, (...)
> But it just seems like a waste to burn 1/3 of minors.

Could potentially work I guess.

> Perhaps it would also be possible to go with:
> 0-63 primary, 64-127 empty, 128-191 render, 192-512K continuous range
> where we distribute minors first-come first-serve, without any link to type (so
> usually we'd get continuous card192, renderD193, and so on)

We would need to re-design drmGetMinorType if we go down this path.

  parent reply	other threads:[~2022-08-19  8:16 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-08-17 23:05 [PATCH 0/3] drm: Use full allocated minor range for DRM Michał Winiarski
2022-08-17 23:05 ` [PATCH 1/3] drm: Don't reserve minors for control nodes Michał Winiarski
2022-08-17 23:05 ` [PATCH 2/3] drm: Expand max DRM device number to full MINORBITS Michał Winiarski
2022-08-17 23:06 ` [PATCH 3/3] drm: Use mutex for minors Michał Winiarski
     [not found] ` <wWV4E0y1qoweGL7vMn0IgY903SnA0rN5qqy_58NIvSX9j0XkFb1JKTmea4HhNCPsxCUe88Ni7HUa2Bu1UMIxtZZh1nrIR3aVaoooDiAaUvU=@emersion.fr>
     [not found]   ` <20220818120616.xuhlnsckjd4octwb@nostramo.hardline.pl>
2022-08-19  8:16     ` Simon Ser [this message]
2022-08-19  9:14       ` [PATCH 0/3] drm: Use full allocated minor range for DRM Michał Winiarski

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='QfMoMae4qM8am6w1mha9iE_XrkqBLaR3r0gaT8oxaXDgysa0_8Si7kQuirRgJ-x_4YPILalQsNJKJqyi5ZDScnPUv65cPwd0y3di5Dntmrw=@emersion.fr' \
    --to=contact@emersion.fr \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=michal.winiarski@intel.com \
    --cc=tzimmermann@suse.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).