Skip to contentSkip to conversation

drm/hyperv: Added error message for fb size greater then allocated

PATCH Superseded Saurabh Sengar 3 participants 4 messages Apr 7, 2022

Subsystems (5)

v2 of 4 Superseded Latest is v4 →

lore
Share & tools
lore

Saurabh Sengar

author maintainer
#0 lore raw

PATCH v2 1/1 drm/hyperv: Added error message for fb size greater then allocated

Added error message when the size of requested framebuffer is more then the allocated size by vmbus mmio region for framebuffer

---
v1 -> v2 : Corrected Sign-off

 drivers/gpu/drm/hyperv/hyperv_drm_modeset.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)
drivers/gpu/drm/hyperv/hyperv_drm_modeset.c +4 -1
index e82b815..92587f0 100644
@@ -123,8 +123,11 @@ static int hyperv_pipe_check(struct drm_simple_display_pipe *pipe,
 	if (fb->format->format != DRM_FORMAT_XRGB8888)
 		return -EINVAL;
 
-	if (fb->pitches[0] * fb->height > hv->fb_size)
+	if (fb->pitches[0] * fb->height > hv->fb_size) {
+		drm_err(&hv->dev, "hv->hdev, fb size requested by process %s for %d X %d (pitch %d) is greater then allocated size %ld\n",
+		current->comm, fb->width, fb->height, fb->pitches[0], hv->fb_size);
 		return -EINVAL;
+	}
 
 	return 0;
 }
Signature · 1 line
1.8.3.1
maintainer
#1 lore raw
Quoted 15 lines · Saurabh Sengar

Added error message when the size of requested framebuffer is more then the allocated size by vmbus mmio region for framebuffer

---
v1 -> v2 : Corrected Sign-off

 drivers/gpu/drm/hyperv/hyperv_drm_modeset.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)
drivers/gpu/drm/hyperv/hyperv_drm_modeset.c +0 -0
index e82b815..92587f0 100644

drivers/gpu/drm/hyperv/hyperv_drm_modeset.c static int hyperv_pipe_check(struct drm_simple_display_pipe *pipe, · line 127

Quoted 6 lines
drivers/gpu/drm/hyperv/hyperv_drm_modeset.c +2 -1
@@ -123,8 +123,11 @@ static int hyperv_pipe_check(struct drm_simple_display_pipe *pipe,
 	if (fb->format->format != DRM_FORMAT_XRGB8888)
 		return -EINVAL;
 
-	if (fb->pitches[0] * fb->height > hv->fb_size)
+	if (fb->pitches[0] * fb->height > hv->fb_size) {
+		drm_err(&hv->dev, "hv->hdev, fb size requested by process %s for %d X %d (pitch %d) is greater then allocated size %ld\n",

then -> than.

Quoted 9 lines
drivers/gpu/drm/hyperv/hyperv_drm_modeset.c +2 -0
+		current->comm, fb->width, fb->height, fb->pitches[0], hv->fb_size);
 		return -EINVAL;
+	}
 
 	return 0;
 }
Signature · 1 line
1.8.3.1
#2 lore raw
In reply to Saurabh Sengar
Quoted 16 lines · Saurabh Sengar

Added error message when the size of requested framebuffer is more then the allocated size by vmbus mmio region for framebuffer

---
v1 -> v2 : Corrected Sign-off

 drivers/gpu/drm/hyperv/hyperv_drm_modeset.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)
drivers/gpu/drm/hyperv/hyperv_drm_modeset.c +0 -0
index e82b815..92587f0 100644

drivers/gpu/drm/hyperv/hyperv_drm_modeset.c static int hyperv_pipe_check(struct drm_simple_display_pipe *pipe, · line 128

Quoted 7 lines
drivers/gpu/drm/hyperv/hyperv_drm_modeset.c +3 -1
@@ -123,8 +123,11 @@ static int hyperv_pipe_check(struct drm_simple_display_pipe *pipe,
        if (fb->format->format != DRM_FORMAT_XRGB8888)
                return -EINVAL;
 
-       if (fb->pitches[0] * fb->height > hv->fb_size)
+       if (fb->pitches[0] * fb->height > hv->fb_size) {
+               drm_err(&hv->dev, "hv->hdev, fb size requested by process %s for %d X %d (pitch %d) is greater then allocated size %ld\n",
+               current->comm, fb->width, fb->height, fb->pitches[0], hv->fb_size);

Any reason to add an error message here. Since this function is called whenever there is an update, avoid printing an error here.

Quoted 8 lines
drivers/gpu/drm/hyperv/hyperv_drm_modeset.c +1 -1
                return -EINVAL;
+       }
 
        return 0;
 }
--

1.8.3.1

author maintainer
#3 lore raw
Quoted 21 lines · Deepak Rawat
Quoted 19 lines · Saurabh Sengar

Added error message when the size of requested framebuffer is more then the allocated size by vmbus mmio region for framebuffer

---
v1 -> v2 : Corrected Sign-off

 drivers/gpu/drm/hyperv/hyperv_drm_modeset.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)
drivers/gpu/drm/hyperv/hyperv_drm_modeset.c +0 -0
index e82b815..92587f0 100644
@@ -123,8 +123,11 @@ static int hyperv_pipe_check(struct drm_simple_display_pipe *pipe,
        if (fb->format->format != DRM_FORMAT_XRGB8888)
                return -EINVAL;
 
Quoted 7 lines

drivers/gpu/drm/hyperv/hyperv_drm_modeset.c static int hyperv_pipe_check(struct drm_simple_display_pipe *pipe, · line 128

Quoted 4 lines
drivers/gpu/drm/hyperv/hyperv_drm_modeset.c +3 -1
-       if (fb->pitches[0] * fb->height > hv->fb_size)
+       if (fb->pitches[0] * fb->height > hv->fb_size) {
+               drm_err(&hv->dev, "hv->hdev, fb size requested by process %s for %d X %d (pitch %d) is greater then allocated size %ld\n",
+               current->comm, fb->width, fb->height, fb->pitches[0], hv->fb_size);

Any reason to add an error message here. Since this function is called whenever there is an update, avoid printing an error here.

Recently we hit an issue where userspace application was programing the bigger size buffer then the actual allocated size for framebuffer by hyperv vmbus. This resulted in black screen, and there was no error message it was failing silently and took a
while to debug this issue. Although the function will be called in each update but this error is printed only in fatal case where pipeline is fail to set the crtc for desired resolution.

Quoted 9 lines
Quoted 9 lines
drivers/gpu/drm/hyperv/hyperv_drm_modeset.c +1 -1
                return -EINVAL;
+       }
 
        return 0;
 }
--

1.8.3.1