From: Thierry Reding <thierry.reding@gmail.com>
To: Daniel Vetter <daniel.vetter@ffwll.ch>
Cc: Daniel Vetter <daniel.vetter@intel.com>,
Intel Graphics Development <intel-gfx@lists.freedesktop.org>,
Rajat Jain <rajatja@google.com>,
DRI Development <dri-devel@lists.freedesktop.org>
Subject: Re: [PATCH 1/2] drm/property: Enforce more lifetime rules
Date: Thu, 24 Oct 2019 12:40:55 +0200 [thread overview]
Message-ID: <20191024104055.GC2825247@ulmo> (raw)
In-Reply-To: <20191023144953.28190-1-daniel.vetter@ffwll.ch>
[-- Attachment #1.1: Type: text/plain, Size: 2376 bytes --]
On Wed, Oct 23, 2019 at 04:49:52PM +0200, Daniel Vetter wrote:
> Properties can't be attached after registering, userspace would get
> confused (no one bothers to reprobe really).
>
> - Add kerneldoc
> - Enforce this with some checks. This needs a somewhat ugly check
> since connectors can be added later on, but we still need to attach
> all properties before they go public.
>
> Note that we already enforce that properties themselves are created
> before the entire device is registered.
>
> Cc: Jani Nikula <jani.nikula@linux.intel.com>
> Cc: Rajat Jain <rajatja@google.com>
> Signed-off-by: Daniel Vetter <daniel.vetter@intel.com>
> ---
> drivers/gpu/drm/drm_mode_object.c | 14 ++++++++++++++
> 1 file changed, 14 insertions(+)
>
> diff --git a/drivers/gpu/drm/drm_mode_object.c b/drivers/gpu/drm/drm_mode_object.c
> index 6a23e36ed4fe..35c2719407a8 100644
> --- a/drivers/gpu/drm/drm_mode_object.c
> +++ b/drivers/gpu/drm/drm_mode_object.c
> @@ -224,12 +224,26 @@ EXPORT_SYMBOL(drm_mode_object_get);
> * This attaches the given property to the modeset object with the given initial
> * value. Currently this function cannot fail since the properties are stored in
> * a statically sized array.
> + *
> + * Note that all properties must be attached before the object itself is
> + * registered and accessible from userspace.
> */
> void drm_object_attach_property(struct drm_mode_object *obj,
> struct drm_property *property,
> uint64_t init_val)
> {
> int count = obj->properties->count;
> + struct drm_device *dev = property->dev;
> +
> +
> + if (obj->type == DRM_MODE_OBJECT_CONNECTOR) {
> + struct drm_connector *connector = obj_to_connector(obj);
> +
> + WARN_ON(!dev->driver->load &&
> + connector->registration_state == DRM_CONNECTOR_REGISTERED);
> + } else {
> + WARN_ON(!dev->driver->load && dev->registered);
> + }
I'm not sure I understand why dev->driver->load needs to be a special
case. Don't the same rules apply for those drivers as well?
Thierry
>
> if (count == DRM_OBJECT_MAX_PROPERTY) {
> WARN(1, "Failed to attach object property (type: 0x%x). Please "
> --
> 2.23.0
>
> _______________________________________________
> Intel-gfx mailing list
> Intel-gfx@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/intel-gfx
[-- Attachment #1.2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]
[-- Attachment #2: Type: text/plain, Size: 159 bytes --]
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
WARNING: multiple messages have this Message-ID (diff)
From: Thierry Reding <thierry.reding@gmail.com>
To: Daniel Vetter <daniel.vetter@ffwll.ch>
Cc: Daniel Vetter <daniel.vetter@intel.com>,
Intel Graphics Development <intel-gfx@lists.freedesktop.org>,
Rajat Jain <rajatja@google.com>,
DRI Development <dri-devel@lists.freedesktop.org>
Subject: Re: [Intel-gfx] [PATCH 1/2] drm/property: Enforce more lifetime rules
Date: Thu, 24 Oct 2019 12:40:55 +0200 [thread overview]
Message-ID: <20191024104055.GC2825247@ulmo> (raw)
Message-ID: <20191024104055.C0HFle0IMa8vUhTCDioIz920StbLAeBZYq3VTC2akiA@z> (raw)
In-Reply-To: <20191023144953.28190-1-daniel.vetter@ffwll.ch>
[-- Attachment #1.1: Type: text/plain, Size: 2376 bytes --]
On Wed, Oct 23, 2019 at 04:49:52PM +0200, Daniel Vetter wrote:
> Properties can't be attached after registering, userspace would get
> confused (no one bothers to reprobe really).
>
> - Add kerneldoc
> - Enforce this with some checks. This needs a somewhat ugly check
> since connectors can be added later on, but we still need to attach
> all properties before they go public.
>
> Note that we already enforce that properties themselves are created
> before the entire device is registered.
>
> Cc: Jani Nikula <jani.nikula@linux.intel.com>
> Cc: Rajat Jain <rajatja@google.com>
> Signed-off-by: Daniel Vetter <daniel.vetter@intel.com>
> ---
> drivers/gpu/drm/drm_mode_object.c | 14 ++++++++++++++
> 1 file changed, 14 insertions(+)
>
> diff --git a/drivers/gpu/drm/drm_mode_object.c b/drivers/gpu/drm/drm_mode_object.c
> index 6a23e36ed4fe..35c2719407a8 100644
> --- a/drivers/gpu/drm/drm_mode_object.c
> +++ b/drivers/gpu/drm/drm_mode_object.c
> @@ -224,12 +224,26 @@ EXPORT_SYMBOL(drm_mode_object_get);
> * This attaches the given property to the modeset object with the given initial
> * value. Currently this function cannot fail since the properties are stored in
> * a statically sized array.
> + *
> + * Note that all properties must be attached before the object itself is
> + * registered and accessible from userspace.
> */
> void drm_object_attach_property(struct drm_mode_object *obj,
> struct drm_property *property,
> uint64_t init_val)
> {
> int count = obj->properties->count;
> + struct drm_device *dev = property->dev;
> +
> +
> + if (obj->type == DRM_MODE_OBJECT_CONNECTOR) {
> + struct drm_connector *connector = obj_to_connector(obj);
> +
> + WARN_ON(!dev->driver->load &&
> + connector->registration_state == DRM_CONNECTOR_REGISTERED);
> + } else {
> + WARN_ON(!dev->driver->load && dev->registered);
> + }
I'm not sure I understand why dev->driver->load needs to be a special
case. Don't the same rules apply for those drivers as well?
Thierry
>
> if (count == DRM_OBJECT_MAX_PROPERTY) {
> WARN(1, "Failed to attach object property (type: 0x%x). Please "
> --
> 2.23.0
>
> _______________________________________________
> Intel-gfx mailing list
> Intel-gfx@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/intel-gfx
[-- Attachment #1.2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]
[-- Attachment #2: Type: text/plain, Size: 159 bytes --]
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel
WARNING: multiple messages have this Message-ID (diff)
From: Thierry Reding <thierry.reding@gmail.com>
To: Daniel Vetter <daniel.vetter@ffwll.ch>
Cc: Daniel Vetter <daniel.vetter@intel.com>,
Intel Graphics Development <intel-gfx@lists.freedesktop.org>,
Rajat Jain <rajatja@google.com>,
DRI Development <dri-devel@lists.freedesktop.org>
Subject: Re: [Intel-gfx] [PATCH 1/2] drm/property: Enforce more lifetime rules
Date: Thu, 24 Oct 2019 12:40:55 +0200 [thread overview]
Message-ID: <20191024104055.GC2825247@ulmo> (raw)
Message-ID: <20191024104055.2PXdH_oi58m6bui_8P596oDYhdTRP4KQONriybP0cIM@z> (raw)
In-Reply-To: <20191023144953.28190-1-daniel.vetter@ffwll.ch>
[-- Attachment #1.1: Type: text/plain, Size: 2376 bytes --]
On Wed, Oct 23, 2019 at 04:49:52PM +0200, Daniel Vetter wrote:
> Properties can't be attached after registering, userspace would get
> confused (no one bothers to reprobe really).
>
> - Add kerneldoc
> - Enforce this with some checks. This needs a somewhat ugly check
> since connectors can be added later on, but we still need to attach
> all properties before they go public.
>
> Note that we already enforce that properties themselves are created
> before the entire device is registered.
>
> Cc: Jani Nikula <jani.nikula@linux.intel.com>
> Cc: Rajat Jain <rajatja@google.com>
> Signed-off-by: Daniel Vetter <daniel.vetter@intel.com>
> ---
> drivers/gpu/drm/drm_mode_object.c | 14 ++++++++++++++
> 1 file changed, 14 insertions(+)
>
> diff --git a/drivers/gpu/drm/drm_mode_object.c b/drivers/gpu/drm/drm_mode_object.c
> index 6a23e36ed4fe..35c2719407a8 100644
> --- a/drivers/gpu/drm/drm_mode_object.c
> +++ b/drivers/gpu/drm/drm_mode_object.c
> @@ -224,12 +224,26 @@ EXPORT_SYMBOL(drm_mode_object_get);
> * This attaches the given property to the modeset object with the given initial
> * value. Currently this function cannot fail since the properties are stored in
> * a statically sized array.
> + *
> + * Note that all properties must be attached before the object itself is
> + * registered and accessible from userspace.
> */
> void drm_object_attach_property(struct drm_mode_object *obj,
> struct drm_property *property,
> uint64_t init_val)
> {
> int count = obj->properties->count;
> + struct drm_device *dev = property->dev;
> +
> +
> + if (obj->type == DRM_MODE_OBJECT_CONNECTOR) {
> + struct drm_connector *connector = obj_to_connector(obj);
> +
> + WARN_ON(!dev->driver->load &&
> + connector->registration_state == DRM_CONNECTOR_REGISTERED);
> + } else {
> + WARN_ON(!dev->driver->load && dev->registered);
> + }
I'm not sure I understand why dev->driver->load needs to be a special
case. Don't the same rules apply for those drivers as well?
Thierry
>
> if (count == DRM_OBJECT_MAX_PROPERTY) {
> WARN(1, "Failed to attach object property (type: 0x%x). Please "
> --
> 2.23.0
>
> _______________________________________________
> Intel-gfx mailing list
> Intel-gfx@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/intel-gfx
[-- Attachment #1.2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]
[-- Attachment #2: Type: text/plain, Size: 159 bytes --]
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
next prev parent reply other threads:[~2019-10-24 10:40 UTC|newest]
Thread overview: 26+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-10-23 14:49 [PATCH 1/2] drm/property: Enforce more lifetime rules Daniel Vetter
2019-10-23 14:49 ` [Intel-gfx] " Daniel Vetter
2019-10-23 14:49 ` [PATCH 2/2] drm/todo: Add entry to remove load/unload hooks Daniel Vetter
2019-10-23 14:49 ` [Intel-gfx] " Daniel Vetter
2019-10-23 14:49 ` Daniel Vetter
2019-10-24 10:35 ` [Intel-gfx] " Thierry Reding
2019-10-24 10:35 ` Thierry Reding
2019-11-04 16:57 ` Daniel Vetter
2019-11-04 16:57 ` Daniel Vetter
2019-10-24 0:46 ` ✗ Fi.CI.CHECKPATCH: warning for series starting with [1/2] drm/property: Enforce more lifetime rules Patchwork
2019-10-24 0:46 ` [Intel-gfx] " Patchwork
2019-10-24 1:14 ` ✓ Fi.CI.BAT: success " Patchwork
2019-10-24 1:14 ` [Intel-gfx] " Patchwork
2019-10-24 10:40 ` Thierry Reding [this message]
2019-10-24 10:40 ` [Intel-gfx] [PATCH 1/2] " Thierry Reding
2019-10-24 10:40 ` Thierry Reding
2019-10-24 10:43 ` Thierry Reding
2019-10-24 10:43 ` [Intel-gfx] " Thierry Reding
2019-10-24 10:43 ` Thierry Reding
2019-10-24 11:47 ` Daniel Vetter
2019-10-24 11:47 ` Daniel Vetter
2019-10-24 12:09 ` Jani Nikula
2019-10-24 12:09 ` [Intel-gfx] " Jani Nikula
2019-10-24 12:09 ` Jani Nikula
2019-10-24 22:35 ` ✗ Fi.CI.IGT: failure for series starting with [1/2] " Patchwork
2019-10-24 22:35 ` [Intel-gfx] " Patchwork
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=20191024104055.GC2825247@ulmo \
--to=thierry.reding@gmail.com \
--cc=daniel.vetter@ffwll.ch \
--cc=daniel.vetter@intel.com \
--cc=dri-devel@lists.freedesktop.org \
--cc=intel-gfx@lists.freedesktop.org \
--cc=rajatja@google.com \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.