[PATCH] drm/vmwgfx: Fix some scheduling in atomic bugs

Dan Carpenter dan.carpenter at oracle.com
Thu Aug 12 07:00:44 UTC 2021


The vmw_gmrid_man_get_node() function calls vmw_host_printf() while
holding a spinlock so these functions need to be atomic.  Generally,
no one expects printf() functions to sleep.

Fixes: cfdc3458db8a ("drm/vmwgfx: Be a lot more flexible with MOB limits")
Signed-off-by: Dan Carpenter <dan.carpenter at oracle.com>
---
 drivers/gpu/drm/vmwgfx/vmwgfx_msg.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/gpu/drm/vmwgfx/vmwgfx_msg.c b/drivers/gpu/drm/vmwgfx/vmwgfx_msg.c
index ed9c7b3a1e08..16be71c4c679 100644
--- a/drivers/gpu/drm/vmwgfx/vmwgfx_msg.c
+++ b/drivers/gpu/drm/vmwgfx/vmwgfx_msg.c
@@ -506,14 +506,14 @@ int vmw_host_printf(const char *fmt, ...)
 		return ret;
 
 	va_start(ap, fmt);
-	log = kvasprintf(GFP_KERNEL, fmt, ap);
+	log = kvasprintf(GFP_ATOMIC, fmt, ap);
 	va_end(ap);
 	if (!log) {
 		DRM_ERROR("Cannot allocate memory for the log message.\n");
 		return -ENOMEM;
 	}
 
-	msg = kasprintf(GFP_KERNEL, "log %s", log);
+	msg = kasprintf(GFP_ATOMIC, "log %s", log);
 	if (!msg) {
 		DRM_ERROR("Cannot allocate memory for host log message.\n");
 		kfree(log);
-- 
2.20.1



More information about the dri-devel mailing list