Skip to contentSkip to conversation

drm: Log recovery method with wedged event

PATCH Superseded Raag Jadav 3 participants 3 messages Oct 20

Subsystems (2)

v2 of 3 Superseded Latest is v3 →

lore
Share & tools
lore

Raag Jadav

author
#0 lore raw

PATCH v2 1/1 drm: Log recovery method with wedged event

Currently, drm_dev_wedged_event() logs a basic message of device being wedged, but doesn't print the recovery method used by the caller. Log it for easier bug report analysis.

While at it, as device wedging is a catastrophic event for the cases that do need recovery, distinguish them and raise their log level to drm_warn().

---
v2: Distinguish between recovery and no recovery cases (Christian, Rodrigo)

---
 drivers/gpu/drm/drm_drv.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)
drivers/gpu/drm/drm_drv.c +4 -2
index cb53baa70995..7f8abb72f548 100644
@@ -598,8 +598,10 @@ int drm_dev_wedged_event(struct drm_device *dev, unsigned long method,
 		/* Caller is unsure about recovery, do the best we can at this point. */
 		snprintf(event_string, sizeof(event_string), "%s", "WEDGED=unknown");
 
-	drm_info(dev, "device wedged, %s\n", method == DRM_WEDGE_RECOVERY_NONE ?
-		 "but no recovery needed" : "needs recovery");
+	if (method == DRM_WEDGE_RECOVERY_NONE)
+		drm_info(dev, "device wedged, but no recovery needed\n");
+	else
+		drm_warn(dev, "device wedged with method %#lx, needs recovery\n", method);
 
 	if (info && (info->comm[0] != '\0') && (info->pid >= 0)) {
 		snprintf(pid_string, sizeof(pid_string), "PID=%u", info->pid);
Signature · 1 line
2.43.0
#1 lore raw
Quoted 19 lines · Raag Jadav

Currently, drm_dev_wedged_event() logs a basic message of device being wedged, but doesn't print the recovery method used by the caller. Log it for easier bug report analysis.

While at it, as device wedging is a catastrophic event for the cases that do need recovery, distinguish them and raise their log level to drm_warn().

---
v2: Distinguish between recovery and no recovery cases (Christian, Rodrigo)

---
 drivers/gpu/drm/drm_drv.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)
drivers/gpu/drm/drm_drv.c +0 -0
index cb53baa70995..7f8abb72f548 100644

drivers/gpu/drm/drm_drv.c int drm_dev_wedged_event(struct drm_device *dev, unsigned long method, · line 604

Quoted 9 lines
drivers/gpu/drm/drm_drv.c +4 -2
@@ -598,8 +598,10 @@ int drm_dev_wedged_event(struct drm_device *dev, unsigned long method,
 		/* Caller is unsure about recovery, do the best we can at this point. */
 		snprintf(event_string, sizeof(event_string), "%s", "WEDGED=unknown");
 
-	drm_info(dev, "device wedged, %s\n", method == DRM_WEDGE_RECOVERY_NONE ?
-		 "but no recovery needed" : "needs recovery");
+	if (method == DRM_WEDGE_RECOVERY_NONE)
+		drm_info(dev, "device wedged, but no recovery needed\n");
+	else
+		drm_warn(dev, "device wedged with method %#lx, needs recovery\n", method);

That is still not ok.

Again device wedging is a perfectly normal part of operation and clearly doesn't deserves a warning.

As far as I can see userspace can spam the log with warnings by just submitting shaders with an endless loop in it.

Regards,
Christian.

Quoted 3 lines
drivers/gpu/drm/drm_drv.c +0 -0
 	if (info && (info->comm[0] != '\0') && (info->pid >= 0)) {
 		snprintf(pid_string, sizeof(pid_string), "PID=%u", info->pid);
#2 lore raw
Quoted 23 lines · Christian König
Quoted 22 lines · Raag Jadav

Currently, drm_dev_wedged_event() logs a basic message of device being wedged, but doesn't print the recovery method used by the caller. Log it for easier bug report analysis.

While at it, as device wedging is a catastrophic event for the cases that do need recovery, distinguish them and raise their log level to drm_warn().

---
v2: Distinguish between recovery and no recovery cases (Christian, Rodrigo)

---
 drivers/gpu/drm/drm_drv.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)
drivers/gpu/drm/drm_drv.c +0 -0
index cb53baa70995..7f8abb72f548 100644
@@ -598,8 +598,10 @@ int drm_dev_wedged_event(struct drm_device *dev, unsigned long method,
 		/* Caller is unsure about recovery, do the best we can at this point. */
 		snprintf(event_string, sizeof(event_string), "%s", "WEDGED=unknown");
 
Quoted 8 lines

drivers/gpu/drm/drm_drv.c int drm_dev_wedged_event(struct drm_device *dev, unsigned long method, · line 604

Quoted 6 lines
drivers/gpu/drm/drm_drv.c +4 -2
-	drm_info(dev, "device wedged, %s\n", method == DRM_WEDGE_RECOVERY_NONE ?
-		 "but no recovery needed" : "needs recovery");
+	if (method == DRM_WEDGE_RECOVERY_NONE)
+		drm_info(dev, "device wedged, but no recovery needed\n");
+	else
+		drm_warn(dev, "device wedged with method %#lx, needs recovery\n", method);

That is still not ok.

what I had in mind was a explicit option so the drivers can select if it is okay or not.

Quoted 2 lines

Again device wedging is a perfectly normal part of operation and clearly doesn't deserves a warning.

sometimes it is not, but I understand your point.

Perhaps we just skip this and in the case where it is not an info + a custom driver warn is okay since everything will be stopped anyway in this cathastropic case.

Quoted 10 lines

As far as I can see userspace can spam the log with warnings by just submitting shaders with an endless loop in it.

Regards,
Christian.

Quoted 3 lines
drivers/gpu/drm/drm_drv.c +0 -0
 	if (info && (info->comm[0] != '\0') && (info->pid >= 0)) {
 		snprintf(pid_string, sizeof(pid_string), "PID=%u", info->pid);