From: James Zhu <jamesz@amd.com>
To: "Michał Winiarski" <michal.winiarski@intel.com>,
dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org,
intel-gfx@lists.freedesktop.org
Cc: "Pekka Paalanen" <pekka.paalanen@collabora.com>,
"David Airlie" <airlied@linux.ie>,
"Oded Gabbay" <ogabbay@kernel.org>,
"Maxime Ripard" <mripard@kernel.org>,
"Emil Velikov" <emil.l.velikov@gmail.com>,
"Matthew Wilcox" <willy@infradead.org>,
"Thomas Zimmermann" <tzimmermann@suse.de>,
"James Zhu" <James.Zhu@amd.com>,
"Christian König" <christian.koenig@amd.com>
Subject: Re: [PATCH v6 3/4] drm: Expand max DRM device number to full MINORBITS
Date: Mon, 24 Jul 2023 18:29:29 -0400 [thread overview]
Message-ID: <6f101468-59ff-fb6f-13e9-87775457ae1d@amd.com> (raw)
In-Reply-To: <20230724211428.3831636-4-michal.winiarski@intel.com>
[-- Attachment #1: Type: text/plain, Size: 2465 bytes --]
On 2023-07-24 17:14, Michał Winiarski wrote:
> Having a limit of 64 DRM devices is not good enough for modern world
> where we have multi-GPU servers, SR-IOV virtual functions and virtual
> devices used for testing.
> Let's utilize full minor range for DRM devices.
> To avoid regressing the existing userspace, we're still maintaining the
> numbering scheme where 0-63 is used for primary, 64-127 is reserved
> (formerly for control) and 128-191 is used for render.
> For minors >= 192, we're allocating minors dynamically on a first-come,
> first-served basis.
[JZ] Hello Michal,
Do you have libdrm patches for review together with this change?
Especially to support static int drmGetMinorType(int major, int minor).
Thanks and Best Regards!
James Zhu
>
> Signed-off-by: Michał Winiarski<michal.winiarski@intel.com>
> ---
> drivers/gpu/drm/drm_drv.c | 12 ++++++++++++
> 1 file changed, 12 insertions(+)
>
> diff --git a/drivers/gpu/drm/drm_drv.c b/drivers/gpu/drm/drm_drv.c
> index 34b60196c443..c2c6e80e6b31 100644
> --- a/drivers/gpu/drm/drm_drv.c
> +++ b/drivers/gpu/drm/drm_drv.c
> @@ -121,10 +121,19 @@ static void drm_minor_alloc_release(struct drm_device *dev, void *data)
> xa_erase(drm_minor_get_xa(minor->type), minor->index);
> }
>
> +/*
> + * DRM used to support 64 devices, for backwards compatibility we need to maintain the
> + * minor allocation scheme where minors 0-63 are primary nodes, 64-127 are control nodes,
> + * and 128-191 are render nodes.
> + * After reaching the limit, we're allocating minors dynamically - first-come, first-serve.
> + * Accel nodes are using a distinct major, so the minors are allocated in continuous 0-MAX
> + * range.
> + */
> #define DRM_MINOR_LIMIT(t) ({ \
> typeof(t) _t = (t); \
> _t == DRM_MINOR_ACCEL ? XA_LIMIT(0, ACCEL_MAX_MINORS) : XA_LIMIT(64 * _t, 64 * _t + 63); \
> })
> +#define DRM_EXTENDED_MINOR_LIMIT XA_LIMIT(192, (1 << MINORBITS) - 1)
>
> static int drm_minor_alloc(struct drm_device *dev, enum drm_minor_type type)
> {
> @@ -140,6 +149,9 @@ static int drm_minor_alloc(struct drm_device *dev, enum drm_minor_type type)
>
> r = xa_alloc(drm_minor_get_xa(type), &minor->index,
> NULL, DRM_MINOR_LIMIT(type), GFP_KERNEL);
> + if (r == -EBUSY && (type == DRM_MINOR_PRIMARY || type == DRM_MINOR_RENDER))
> + r = xa_alloc(&drm_minors_xa, &minor->index,
> + NULL, DRM_EXTENDED_MINOR_LIMIT, GFP_KERNEL);
> if (r < 0)
> return r;
>
[-- Attachment #2: Type: text/html, Size: 4737 bytes --]
next prev parent reply other threads:[~2023-07-24 22:29 UTC|newest]
Thread overview: 22+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-07-24 21:14 [PATCH v6 0/4] drm: Use full allocated minor range for DRM Michał Winiarski
2023-07-24 21:14 ` [PATCH v6 1/4] drm: Use XArray instead of IDR for minors Michał Winiarski
2023-08-25 16:59 ` James Zhu
2023-08-28 21:08 ` Michał Winiarski
2023-08-29 17:34 ` James Zhu
2023-08-29 18:33 ` Matthew Wilcox
2023-08-29 18:35 ` James Zhu
2023-08-29 18:37 ` Matthew Wilcox
2023-07-24 21:14 ` [PATCH v6 2/4] accel: " Michał Winiarski
2023-07-24 21:14 ` [PATCH v6 3/4] drm: Expand max DRM device number to full MINORBITS Michał Winiarski
2023-07-24 22:29 ` James Zhu [this message]
2023-07-26 18:15 ` Simon Ser
2023-07-27 12:01 ` Christian König
2023-07-28 14:22 ` Simon Ser
2023-08-08 13:55 ` Christian König
2023-08-08 15:04 ` James Zhu
2023-08-23 10:53 ` Simon Ser
2023-08-23 10:58 ` Simon Ser
2023-08-23 14:06 ` James Zhu
2023-07-24 21:14 ` [PATCH v6 4/4] drm: Introduce force_extended_minors modparam Michał Winiarski
2023-08-30 16:31 ` [PATCH v6 0/4] drm: Use full allocated minor range for DRM James Zhu
2024-05-03 1:22 ` Eric Pilmore
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=6f101468-59ff-fb6f-13e9-87775457ae1d@amd.com \
--to=jamesz@amd.com \
--cc=James.Zhu@amd.com \
--cc=airlied@linux.ie \
--cc=christian.koenig@amd.com \
--cc=dri-devel@lists.freedesktop.org \
--cc=emil.l.velikov@gmail.com \
--cc=intel-gfx@lists.freedesktop.org \
--cc=linux-kernel@vger.kernel.org \
--cc=michal.winiarski@intel.com \
--cc=mripard@kernel.org \
--cc=ogabbay@kernel.org \
--cc=pekka.paalanen@collabora.com \
--cc=tzimmermann@suse.de \
--cc=willy@infradead.org \
/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 read-only IMAP folder(s) and NNTP newsgroup(s).