drm/lease: Send a distinct uevent
diff mbox series

Message ID 20181129094226.30591-1-daniel.vetter@ffwll.ch
State New
Headers show
Series
  • drm/lease: Send a distinct uevent
Related show

Commit Message

Daniel Vetter Nov. 29, 2018, 9:42 a.m. UTC
Sending the exact same hotplug event is not great uapi. Luckily the
only already merged implementation of leases (in the -modesetting
driver) doesn't care about what kind of uevent it gets, and
unconditionally processes both hotplug and lease changes. So we can
still adjust the uapi here.

But e.g. weston tries to filter stuff, and I guess others might want
to do that too. Try to make that possible. Cc: stable since it's uapi
adjustement that we want to roll out everywhere.

Cc: Keith Packard <keithp@keithp.com>
Cc: Dave Airlie <airlied@redhat.com>
Cc: stable@vger.kernel.org
Signed-off-by: Daniel Vetter <daniel.vetter@intel.com>
---
 drivers/gpu/drm/drm_internal.h |  2 ++
 drivers/gpu/drm/drm_lease.c    |  2 +-
 drivers/gpu/drm/drm_sysfs.c    | 10 ++++++++++
 3 files changed, 13 insertions(+), 1 deletion(-)

Comments

Daniel Vetter Nov. 29, 2018, 10:33 p.m. UTC | #1
On Thu, Nov 29, 2018 at 10:42 AM Daniel Vetter <daniel.vetter@ffwll.ch> wrote:
>
> Sending the exact same hotplug event is not great uapi. Luckily the
> only already merged implementation of leases (in the -modesetting
> driver) doesn't care about what kind of uevent it gets, and
> unconditionally processes both hotplug and lease changes. So we can
> still adjust the uapi here.
>
> But e.g. weston tries to filter stuff, and I guess others might want
> to do that too. Try to make that possible. Cc: stable since it's uapi
> adjustement that we want to roll out everywhere.
>
> Cc: Keith Packard <keithp@keithp.com>
> Cc: Dave Airlie <airlied@redhat.com>
> Cc: stable@vger.kernel.org
> Signed-off-by: Daniel Vetter <daniel.vetter@intel.com>

Michel said on irc that -amdgpu also supports leases already, but it
has the same logic as -modesetting, so would be fine too.
-Daniel

> ---
>  drivers/gpu/drm/drm_internal.h |  2 ++
>  drivers/gpu/drm/drm_lease.c    |  2 +-
>  drivers/gpu/drm/drm_sysfs.c    | 10 ++++++++++
>  3 files changed, 13 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/gpu/drm/drm_internal.h b/drivers/gpu/drm/drm_internal.h
> index c7a7d7ce5d1c..d9caf205e0b3 100644
> --- a/drivers/gpu/drm/drm_internal.h
> +++ b/drivers/gpu/drm/drm_internal.h
> @@ -99,6 +99,8 @@ struct device *drm_sysfs_minor_alloc(struct drm_minor *minor);
>  int drm_sysfs_connector_add(struct drm_connector *connector);
>  void drm_sysfs_connector_remove(struct drm_connector *connector);
>
> +void drm_sysfs_lease_event(struct drm_device *dev);
> +
>  /* drm_gem.c */
>  int drm_gem_init(struct drm_device *dev);
>  void drm_gem_destroy(struct drm_device *dev);
> diff --git a/drivers/gpu/drm/drm_lease.c b/drivers/gpu/drm/drm_lease.c
> index 3650d3c46718..99cba8ea5d82 100644
> --- a/drivers/gpu/drm/drm_lease.c
> +++ b/drivers/gpu/drm/drm_lease.c
> @@ -292,7 +292,7 @@ void drm_lease_destroy(struct drm_master *master)
>
>         if (master->lessor) {
>                 /* Tell the master to check the lessee list */
> -               drm_sysfs_hotplug_event(dev);
> +               drm_sysfs_lease_event(dev);
>                 drm_master_put(&master->lessor);
>         }
>
> diff --git a/drivers/gpu/drm/drm_sysfs.c b/drivers/gpu/drm/drm_sysfs.c
> index b3c1daad1169..ecb7b33002bb 100644
> --- a/drivers/gpu/drm/drm_sysfs.c
> +++ b/drivers/gpu/drm/drm_sysfs.c
> @@ -301,6 +301,16 @@ void drm_sysfs_connector_remove(struct drm_connector *connector)
>         connector->kdev = NULL;
>  }
>
> +void drm_sysfs_lease_event(struct drm_device *dev)
> +{
> +       char *event_string = "LEASE=1";
> +       char *envp[] = { event_string, NULL };
> +
> +       DRM_DEBUG("generating lease event\n");
> +
> +       kobject_uevent_env(&dev->primary->kdev->kobj, KOBJ_CHANGE, envp);
> +}
> +
>  /**
>   * drm_sysfs_hotplug_event - generate a DRM uevent
>   * @dev: DRM device
> --
> 2.19.1
>
Keith Packard Nov. 30, 2018, 12:06 a.m. UTC | #2
Daniel Vetter <daniel.vetter@ffwll.ch> writes:

> Cc: Keith Packard <keithp@keithp.com>

Reviewed-by: Keith Packard <keithp@keithp.com>
Daniel Vetter Nov. 30, 2018, 9:56 a.m. UTC | #3
On Thu, Nov 29, 2018 at 04:06:56PM -0800, Keith Packard wrote:
> Daniel Vetter <daniel.vetter@ffwll.ch> writes:
> 
> > Cc: Keith Packard <keithp@keithp.com>
> 
> Reviewed-by: Keith Packard <keithp@keithp.com>

Thanks for review, pushed to drm-misc-fixes.
-Daniel

Patch
diff mbox series

diff --git a/drivers/gpu/drm/drm_internal.h b/drivers/gpu/drm/drm_internal.h
index c7a7d7ce5d1c..d9caf205e0b3 100644
--- a/drivers/gpu/drm/drm_internal.h
+++ b/drivers/gpu/drm/drm_internal.h
@@ -99,6 +99,8 @@  struct device *drm_sysfs_minor_alloc(struct drm_minor *minor);
 int drm_sysfs_connector_add(struct drm_connector *connector);
 void drm_sysfs_connector_remove(struct drm_connector *connector);
 
+void drm_sysfs_lease_event(struct drm_device *dev);
+
 /* drm_gem.c */
 int drm_gem_init(struct drm_device *dev);
 void drm_gem_destroy(struct drm_device *dev);
diff --git a/drivers/gpu/drm/drm_lease.c b/drivers/gpu/drm/drm_lease.c
index 3650d3c46718..99cba8ea5d82 100644
--- a/drivers/gpu/drm/drm_lease.c
+++ b/drivers/gpu/drm/drm_lease.c
@@ -292,7 +292,7 @@  void drm_lease_destroy(struct drm_master *master)
 
 	if (master->lessor) {
 		/* Tell the master to check the lessee list */
-		drm_sysfs_hotplug_event(dev);
+		drm_sysfs_lease_event(dev);
 		drm_master_put(&master->lessor);
 	}
 
diff --git a/drivers/gpu/drm/drm_sysfs.c b/drivers/gpu/drm/drm_sysfs.c
index b3c1daad1169..ecb7b33002bb 100644
--- a/drivers/gpu/drm/drm_sysfs.c
+++ b/drivers/gpu/drm/drm_sysfs.c
@@ -301,6 +301,16 @@  void drm_sysfs_connector_remove(struct drm_connector *connector)
 	connector->kdev = NULL;
 }
 
+void drm_sysfs_lease_event(struct drm_device *dev)
+{
+	char *event_string = "LEASE=1";
+	char *envp[] = { event_string, NULL };
+
+	DRM_DEBUG("generating lease event\n");
+
+	kobject_uevent_env(&dev->primary->kdev->kobj, KOBJ_CHANGE, envp);
+}
+
 /**
  * drm_sysfs_hotplug_event - generate a DRM uevent
  * @dev: DRM device