Skip to contentSkip to conversation

drm: Add a debug message when getting a prop is missing

PATCH In review Mark Yacoub 2 participants 4 messages May 10, 2022 – May 17, 2022

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 drm: Add a debug message when getting a prop is missing

[Why]
If a connector property is attached but drm_atomic_connector_get_property doesn't handle a case for it, modeteset will crash with a segfault without.

[How]
Add a debug message indicating that a connector property is not handled when user space is trying to read it.

TEST=modetest

---
 drivers/gpu/drm/drm_atomic_uapi.c | 6 ++++++
 1 file changed, 6 insertions(+)
drivers/gpu/drm/drm_atomic_uapi.c +6 -0
index acb1ee93d206..36b0f664dd80 100644
@@ -884,6 +884,12 @@ drm_atomic_connector_get_property(struct drm_connector *connector,
 		return connector->funcs->atomic_get_property(connector,
 				state, property, val);
 	} else {
+		// LOG that the kernel is missing handling this property as a case here.
+		drm_dbg_atomic(
+			dev,
+			"[CONNECTOR:%d:%s] Get Property [PROP:%d:%s] is not handled\n",
+			connector->base.id, connector->name, property->base.id,
+			property->name);
 		return -EINVAL;
 	}
 
Signature · 1 line
2.36.0.512.ge40c2bad7a-goog
#1 lore raw

friendly ping :)

Quoted 37 lines · Mark Yacoub

[Why]
If a connector property is attached but drm_atomic_connector_get_property doesn't handle a case for it, modeteset will crash with a segfault without.

[How]
Add a debug message indicating that a connector property is not handled when user space is trying to read it.

TEST=modetest

---
 drivers/gpu/drm/drm_atomic_uapi.c | 6 ++++++
 1 file changed, 6 insertions(+)
drivers/gpu/drm/drm_atomic_uapi.c +6 -1
index acb1ee93d206..36b0f664dd80 100644
@@ -884,6 +884,12 @@ drm_atomic_connector_get_property(struct drm_connector *connector,
                return connector->funcs->atomic_get_property(connector,
                                state, property, val);
        } else {
+               // LOG that the kernel is missing handling this property as a case here.
+               drm_dbg_atomic(
+                       dev,
+                       "[CONNECTOR:%d:%s] Get Property [PROP:%d:%s] is not handled\n",
+                       connector->base.id, connector->name, property->base.id,
+                       property->name);
                return -EINVAL;
        }
 
--

2.36.0.512.ge40c2bad7a-goog

#2 lore raw
In reply to Mark Yacoub

friendly ping :))

Quoted 37 lines · Mark Yacoub

[Why]
If a connector property is attached but drm_atomic_connector_get_property doesn't handle a case for it, modeteset will crash with a segfault without.

[How]
Add a debug message indicating that a connector property is not handled when user space is trying to read it.

TEST=modetest

---
 drivers/gpu/drm/drm_atomic_uapi.c | 6 ++++++
 1 file changed, 6 insertions(+)
drivers/gpu/drm/drm_atomic_uapi.c +6 -1
index acb1ee93d206..36b0f664dd80 100644
@@ -884,6 +884,12 @@ drm_atomic_connector_get_property(struct drm_connector *connector,
                return connector->funcs->atomic_get_property(connector,
                                state, property, val);
        } else {
+               // LOG that the kernel is missing handling this property as a case here.
+               drm_dbg_atomic(
+                       dev,
+                       "[CONNECTOR:%d:%s] Get Property [PROP:%d:%s] is not handled\n",
+                       connector->base.id, connector->name, property->base.id,
+                       property->name);
                return -EINVAL;
        }
 
--

2.36.0.512.ge40c2bad7a-goog

#3 lore raw
In reply to Mark Yacoub
Quoted 21 lines · Mark Yacoub

[Why]
If a connector property is attached but drm_atomic_connector_get_property doesn't handle a case for it, modeteset will crash with a segfault without.

[How]
Add a debug message indicating that a connector property is not handled when user space is trying to read it.

TEST=modetest

---
 drivers/gpu/drm/drm_atomic_uapi.c | 6 ++++++
 1 file changed, 6 insertions(+)
drivers/gpu/drm/drm_atomic_uapi.c +0 -0
index acb1ee93d206..36b0f664dd80 100644

drivers/gpu/drm/drm_atomic_uapi.c drm_atomic_connector_get_property(struct drm_connector *connector, · line 887

Quoted 4 lines
drivers/gpu/drm/drm_atomic_uapi.c +1 -0
@@ -884,6 +884,12 @@ drm_atomic_connector_get_property(struct drm_connector *connector,
 		return connector->funcs->atomic_get_property(connector,
 				state, property, val);
 	} else {
+		// LOG that the kernel is missing handling this property as a case here.

The comment is unnecessary, and we also don't use // comments.

drivers/gpu/drm/drm_atomic_uapi.c drm_atomic_connector_get_property(struct drm_connector *connector, · line 892

Quoted 5 lines
drivers/gpu/drm/drm_atomic_uapi.c +5 -0
+		drm_dbg_atomic(
+			dev,
+			"[CONNECTOR:%d:%s] Get Property [PROP:%d:%s] is not handled\n",
+			connector->base.id, connector->name, property->base.id,
+			property->name);

Why not use the same message as in drm_atomic_connector_set_property()?

Blank line here.

BR,
Jani.

Quoted 2 lines
drivers/gpu/drm/drm_atomic_uapi.c +0 -0
 		return -EINVAL;
 	}
Signature · 1 line
Jani Nikula, Intel Open Source Graphics Center