Re: [v2,1/2] drm: convert drm_atomic_uapi.c to new debug helpers

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi Simon,

On 11.11.2020 10:07, Simon Ser wrote:
> Migrate from DRM_DEBUG_ATOMIC to drm_dbg_atomic.
>
> Signed-off-by: Simon Ser <contact@xxxxxxxxxxx>
> Cc: Daniel Vetter <daniel@xxxxxxxx>
> Cc: Maarten Lankhorst <maarten.lankhorst@xxxxxxxxxxxxxxx>
> Cc: Maxime Ripard <mripard@xxxxxxxxxx>
> Cc: Thomas Zimmermann <tzimmermann@xxxxxxx>
> Cc: Sam Ravnborg <sam@xxxxxxxxxxxx>
> Cc: Ville Syrjala <ville.syrjala@xxxxxxxxxxxxxxx>
> Reviewed-by: Sam Ravnborg <sam@xxxxxxxxxxxx>

This patch landed in today's linux-next as commit e3aae683e861 ("drm: 
convert drm_atomic_uapi.c to new debug helpers"). Sadly it breaks 
booting all Exynos based boards. Here is example of the panic log:

exynos4-fb 11c00000.fimd: Adding to iommu group 0
OF: graph: no port node found in /soc/fimd@11c00000
OF: graph: no port node found in /soc/dsi@11c80000
[drm] Exynos DRM: using 11c00000.fimd device for DMA mapping operations
exynos-drm exynos-drm: bound 11c00000.fimd (ops fimd_component_ops)
exynos-drm exynos-drm: bound 11c80000.dsi (ops exynos_dsi_component_ops)
exynos-drm exynos-drm: [drm] Cannot find any crtc or sizes
[drm] Initialized exynos 1.1.0 20180330 for exynos-drm on minor 0
panel-samsung-s6e8aa0 11c80000.dsi.0: ID: 0x12, 0x8e, 0x9f
8<--- cut here ---
Unable to handle kernel NULL pointer dereference at virtual address 00000000
pgd = (ptrval)
[00000000] *pgd=00000000
Internal error: Oops: 5 [#1] PREEMPT SMP ARM
Modules linked in:
CPU: 0 PID: 1 Comm: swapper/0 Not tainted 5.10.0-rc3-00986-ge3aae683e861 
#2003
Hardware name: Samsung Exynos (Flattened Device Tree)
PC is at drm_atomic_set_crtc_for_connector+0xe4/0x124
LR is at drm_mode_object_put+0x30/0x80
...
Process swapper/0 (pid: 1, stack limit = 0x(ptrval))
Stack: (0xc1cf7940 to 0xc1cf8000)
...
[<c065b164>] (drm_atomic_set_crtc_for_connector) from [<c0642728>] 
(__drm_atomic_helper_set_config+0x1c4/0x368)
[<c0642728>] (__drm_atomic_helper_set_config) from [<c0658e28>] 
(drm_client_modeset_commit_atomic+0x180/0x284)
[<c0658e28>] (drm_client_modeset_commit_atomic) from [<c065900c>] 
(drm_client_modeset_commit_locked+0x64/0x1cc)
[<c065900c>] (drm_client_modeset_commit_locked) from [<c062a780>] 
(drm_fb_helper_pan_display+0x9c/0x1d0)
[<c062a780>] (drm_fb_helper_pan_display) from [<c0590be0>] 
(fb_pan_display+0xbc/0x148)
[<c0590be0>] (fb_pan_display) from [<c059ca30>] (bit_update_start+0x14/0x30)
[<c059ca30>] (bit_update_start) from [<c0598904>] (fbcon_switch+0x484/0x4e0)
[<c0598904>] (fbcon_switch) from [<c05e8828>] (redraw_screen+0x178/0x210)
[<c05e8828>] (redraw_screen) from [<c059ac6c>] 
(fbcon_prepare_logo+0x40c/0x47c)
[<c059ac6c>] (fbcon_prepare_logo) from [<c059b53c>] (fbcon_init+0x468/0x608)
[<c059b53c>] (fbcon_init) from [<c05e6ac0>] (visual_init+0xc0/0x108)
[<c05e6ac0>] (visual_init) from [<c05e91d8>] 
(do_bind_con_driver+0x180/0x39c)
[<c05e91d8>] (do_bind_con_driver) from [<c05e9778>] 
(do_take_over_console+0x140/0x1cc)
[<c05e9778>] (do_take_over_console) from [<c059944c>] 
(do_fbcon_takeover+0x84/0xe0)
[<c059944c>] (do_fbcon_takeover) from [<c0591a58>] 
(register_framebuffer+0x1cc/0x2dc)
[<c0591a58>] (register_framebuffer) from [<c062af78>] 
(__drm_fb_helper_initial_config_and_unlock+0x3f0/0x5e8)
[<c062af78>] (__drm_fb_helper_initial_config_and_unlock) from 
[<c06187c0>] (drm_kms_helper_hotplug_event+0x24/0x30)
[<c06187c0>] (drm_kms_helper_hotplug_event) from [<c0669c84>] 
(exynos_dsi_host_attach+0x184/0x2c8)
[<c0669c84>] (exynos_dsi_host_attach) from [<c067203c>] 
(s6e8aa0_probe+0x1b0/0x218)
[<c067203c>] (s6e8aa0_probe) from [<c068dc58>] (really_probe+0x200/0x4fc)
[<c068dc58>] (really_probe) from [<c068e11c>] 
(driver_probe_device+0x78/0x1fc)
[<c068e11c>] (driver_probe_device) from [<c068e504>] 
(device_driver_attach+0x58/0x60)
[<c068e504>] (device_driver_attach) from [<c068e5e8>] 
(__driver_attach+0xdc/0x174)
[<c068e5e8>] (__driver_attach) from [<c068b9e0>] 
(bus_for_each_dev+0x68/0xb4)
[<c068b9e0>] (bus_for_each_dev) from [<c068cd14>] 
(bus_add_driver+0x158/0x214)
[<c068cd14>] (bus_add_driver) from [<c068f45c>] (driver_register+0x78/0x110)
[<c068f45c>] (driver_register) from [<c0102484>] 
(do_one_initcall+0x8c/0x42c)
[<c0102484>] (do_one_initcall) from [<c11011c0>] 
(kernel_init_freeable+0x190/0x1dc)
[<c11011c0>] (kernel_init_freeable) from [<c0b232dc>] 
(kernel_init+0x8/0x118)
[<c0b232dc>] (kernel_init) from [<c0100114>] (ret_from_fork+0x14/0x20)
Exception stack(0xc1cf7fb0 to 0xc1cf7ff8)
...
---[ end trace 8ff0b5f6297ccc4f ]---
Kernel panic - not syncing: Attempted to kill init! exitcode=0x0000000b

Reverting it on top of linux-next fixes the issue.

> ---
>   drivers/gpu/drm/drm_atomic_uapi.c | 113 +++++++++++++++++-------------
>   1 file changed, 66 insertions(+), 47 deletions(-)
>
> diff --git a/drivers/gpu/drm/drm_atomic_uapi.c b/drivers/gpu/drm/drm_atomic_uapi.c
> index ef82009035e6..efab3d518891 100644
> --- a/drivers/gpu/drm/drm_atomic_uapi.c
> +++ b/drivers/gpu/drm/drm_atomic_uapi.c
> @@ -85,13 +85,15 @@ int drm_atomic_set_mode_for_crtc(struct drm_crtc_state *state,
>   
>   		drm_mode_copy(&state->mode, mode);
>   		state->enable = true;
> -		DRM_DEBUG_ATOMIC("Set [MODE:%s] for [CRTC:%d:%s] state %p\n",
> -				 mode->name, crtc->base.id, crtc->name, state);
> +		drm_dbg_atomic(crtc->dev,
> +			       "Set [MODE:%s] for [CRTC:%d:%s] state %p\n",
> +			       mode->name, crtc->base.id, crtc->name, state);
>   	} else {
>   		memset(&state->mode, 0, sizeof(state->mode));
>   		state->enable = false;
> -		DRM_DEBUG_ATOMIC("Set [NOMODE] for [CRTC:%d:%s] state %p\n",
> -				 crtc->base.id, crtc->name, state);
> +		drm_dbg_atomic(crtc->dev,
> +			       "Set [NOMODE] for [CRTC:%d:%s] state %p\n",
> +			       crtc->base.id, crtc->name, state);
>   	}
>   
>   	return 0;
> @@ -128,31 +130,35 @@ int drm_atomic_set_mode_prop_for_crtc(struct drm_crtc_state *state,
>   		int ret;
>   
>   		if (blob->length != sizeof(struct drm_mode_modeinfo)) {
> -			DRM_DEBUG_ATOMIC("[CRTC:%d:%s] bad mode blob length: %zu\n",
> -					 crtc->base.id, crtc->name,
> -					 blob->length);
> +			drm_dbg_atomic(crtc->dev,
> +				       "[CRTC:%d:%s] bad mode blob length: %zu\n",
> +				       crtc->base.id, crtc->name,
> +				       blob->length);
>   			return -EINVAL;
>   		}
>   
>   		ret = drm_mode_convert_umode(crtc->dev,
>   					     &state->mode, blob->data);
>   		if (ret) {
> -			DRM_DEBUG_ATOMIC("[CRTC:%d:%s] invalid mode (ret=%d, status=%s):\n",
> -					 crtc->base.id, crtc->name,
> -					 ret, drm_get_mode_status_name(state->mode.status));
> +			drm_dbg_atomic(crtc->dev,
> +				       "[CRTC:%d:%s] invalid mode (ret=%d, status=%s):\n",
> +				       crtc->base.id, crtc->name,
> +				       ret, drm_get_mode_status_name(state->mode.status));
>   			drm_mode_debug_printmodeline(&state->mode);
>   			return -EINVAL;
>   		}
>   
>   		state->mode_blob = drm_property_blob_get(blob);
>   		state->enable = true;
> -		DRM_DEBUG_ATOMIC("Set [MODE:%s] for [CRTC:%d:%s] state %p\n",
> -				 state->mode.name, crtc->base.id, crtc->name,
> -				 state);
> +		drm_dbg_atomic(crtc->dev,
> +			       "Set [MODE:%s] for [CRTC:%d:%s] state %p\n",
> +			       state->mode.name, crtc->base.id, crtc->name,
> +			       state);
>   	} else {
>   		state->enable = false;
> -		DRM_DEBUG_ATOMIC("Set [NOMODE] for [CRTC:%d:%s] state %p\n",
> -				 crtc->base.id, crtc->name, state);
> +		drm_dbg_atomic(crtc->dev,
> +			       "Set [NOMODE] for [CRTC:%d:%s] state %p\n",
> +			       crtc->base.id, crtc->name, state);
>   	}
>   
>   	return 0;
> @@ -202,12 +208,14 @@ drm_atomic_set_crtc_for_plane(struct drm_plane_state *plane_state,
>   	}
>   
>   	if (crtc)
> -		DRM_DEBUG_ATOMIC("Link [PLANE:%d:%s] state %p to [CRTC:%d:%s]\n",
> -				 plane->base.id, plane->name, plane_state,
> -				 crtc->base.id, crtc->name);
> +		drm_dbg_atomic(plane->dev,
> +			       "Link [PLANE:%d:%s] state %p to [CRTC:%d:%s]\n",
> +			       plane->base.id, plane->name, plane_state,
> +			       crtc->base.id, crtc->name);
>   	else
> -		DRM_DEBUG_ATOMIC("Link [PLANE:%d:%s] state %p to [NOCRTC]\n",
> -				 plane->base.id, plane->name, plane_state);
> +		drm_dbg_atomic(plane->dev,
> +			       "Link [PLANE:%d:%s] state %p to [NOCRTC]\n",
> +			       plane->base.id, plane->name, plane_state);
>   
>   	return 0;
>   }
> @@ -230,12 +238,14 @@ drm_atomic_set_fb_for_plane(struct drm_plane_state *plane_state,
>   	struct drm_plane *plane = plane_state->plane;
>   
>   	if (fb)
> -		DRM_DEBUG_ATOMIC("Set [FB:%d] for [PLANE:%d:%s] state %p\n",
> -				 fb->base.id, plane->base.id, plane->name,
> -				 plane_state);
> +		drm_dbg_atomic(plane->dev,
> +			       "Set [FB:%d] for [PLANE:%d:%s] state %p\n",
> +			       fb->base.id, plane->base.id, plane->name,
> +			       plane_state);
>   	else
> -		DRM_DEBUG_ATOMIC("Set [NOFB] for [PLANE:%d:%s] state %p\n",
> -				 plane->base.id, plane->name, plane_state);
> +		drm_dbg_atomic(plane->dev,
> +			       "Set [NOFB] for [PLANE:%d:%s] state %p\n",
> +			       plane->base.id, plane->name, plane_state);
>   
>   	drm_framebuffer_assign(&plane_state->fb, fb);
>   }
> @@ -324,13 +334,15 @@ drm_atomic_set_crtc_for_connector(struct drm_connector_state *conn_state,
>   		drm_connector_get(conn_state->connector);
>   		conn_state->crtc = crtc;
>   
> -		DRM_DEBUG_ATOMIC("Link [CONNECTOR:%d:%s] state %p to [CRTC:%d:%s]\n",
> -				 connector->base.id, connector->name,
> -				 conn_state, crtc->base.id, crtc->name);
> +		drm_dbg_atomic(crtc->dev,
> +			       "Link [CONNECTOR:%d:%s] state %p to [CRTC:%d:%s]\n",
> +			       connector->base.id, connector->name,
> +			       conn_state, crtc->base.id, crtc->name);
>   	} else {
> -		DRM_DEBUG_ATOMIC("Link [CONNECTOR:%d:%s] state %p to [NOCRTC]\n",
> -				 connector->base.id, connector->name,
> -				 conn_state);
> +		drm_dbg_atomic(crtc->dev,
> +			       "Link [CONNECTOR:%d:%s] state %p to [NOCRTC]\n",
> +			       connector->base.id, connector->name,
> +			       conn_state);
>   	}
>   
>   	return 0;
> @@ -474,9 +486,10 @@ static int drm_atomic_crtc_set_property(struct drm_crtc *crtc,
>   	} else if (crtc->funcs->atomic_set_property) {
>   		return crtc->funcs->atomic_set_property(crtc, state, property, val);
>   	} else {
> -		DRM_DEBUG_ATOMIC("[CRTC:%d:%s] unknown property [PROP:%d:%s]]\n",
> -				 crtc->base.id, crtc->name,
> -				 property->base.id, property->name);
> +		drm_dbg_atomic(crtc->dev,
> +			       "[CRTC:%d:%s] unknown property [PROP:%d:%s]]\n",
> +			       crtc->base.id, crtc->name,
> +			       property->base.id, property->name);
>   		return -EINVAL;
>   	}
>   
> @@ -570,8 +583,9 @@ static int drm_atomic_plane_set_property(struct drm_plane *plane,
>   		state->pixel_blend_mode = val;
>   	} else if (property == plane->rotation_property) {
>   		if (!is_power_of_2(val & DRM_MODE_ROTATE_MASK)) {
> -			DRM_DEBUG_ATOMIC("[PLANE:%d:%s] bad rotation bitmask: 0x%llx\n",
> -					 plane->base.id, plane->name, val);
> +			drm_dbg_atomic(plane->dev,
> +				       "[PLANE:%d:%s] bad rotation bitmask: 0x%llx\n",
> +				       plane->base.id, plane->name, val);
>   			return -EINVAL;
>   		}
>   		state->rotation = val;
> @@ -595,9 +609,10 @@ static int drm_atomic_plane_set_property(struct drm_plane *plane,
>   		return plane->funcs->atomic_set_property(plane, state,
>   				property, val);
>   	} else {
> -		DRM_DEBUG_ATOMIC("[PLANE:%d:%s] unknown property [PROP:%d:%s]]\n",
> -				 plane->base.id, plane->name,
> -				 property->base.id, property->name);
> +		drm_dbg_atomic(plane->dev,
> +			       "[PLANE:%d:%s] unknown property [PROP:%d:%s]]\n",
> +			       plane->base.id, plane->name,
> +			       property->base.id, property->name);
>   		return -EINVAL;
>   	}
>   
> @@ -665,17 +680,20 @@ static int drm_atomic_set_writeback_fb_for_connector(
>   		struct drm_framebuffer *fb)
>   {
>   	int ret;
> +	struct drm_connector *conn = conn_state->connector;
>   
>   	ret = drm_writeback_set_fb(conn_state, fb);
>   	if (ret < 0)
>   		return ret;
>   
>   	if (fb)
> -		DRM_DEBUG_ATOMIC("Set [FB:%d] for connector state %p\n",
> -				 fb->base.id, conn_state);
> +		drm_dbg_atomic(conn->dev,
> +			       "Set [FB:%d] for connector state %p\n",
> +			       fb->base.id, conn_state);
>   	else
> -		DRM_DEBUG_ATOMIC("Set [NOFB] for connector state %p\n",
> -				 conn_state);
> +		drm_dbg_atomic(conn->dev,
> +			       "Set [NOFB] for connector state %p\n",
> +			       conn_state);
>   
>   	return 0;
>   }
> @@ -782,9 +800,10 @@ static int drm_atomic_connector_set_property(struct drm_connector *connector,
>   		return connector->funcs->atomic_set_property(connector,
>   				state, property, val);
>   	} else {
> -		DRM_DEBUG_ATOMIC("[CONNECTOR:%d:%s] unknown property [PROP:%d:%s]]\n",
> -				 connector->base.id, connector->name,
> -				 property->base.id, property->name);
> +		drm_dbg_atomic(connector->dev,
> +			       "[CONNECTOR:%d:%s] unknown property [PROP:%d:%s]]\n",
> +			       connector->base.id, connector->name,
> +			       property->base.id, property->name);
>   		return -EINVAL;
>   	}
>   
> @@ -1282,7 +1301,7 @@ static void complete_signaling(struct drm_device *dev,
>   		/* If this fails log error to the user */
>   		if (fence_state[i].out_fence_ptr &&
>   		    put_user(-1, fence_state[i].out_fence_ptr))
> -			DRM_DEBUG_ATOMIC("Couldn't clear out_fence_ptr\n");
> +			drm_dbg_atomic(dev, "Couldn't clear out_fence_ptr\n");
>   	}
>   
>   	kfree(fence_state);

Best regards
-- 
Marek Szyprowski, PhD
Samsung R&D Institute Poland




[Index of Archives]     [Linux SoC Development]     [Linux Rockchip Development]     [Linux for Synopsys ARC Processors]    
  • [Linux on Unisoc (RDA Micro) SoCs]     [Linux Actions SoC]     [Linux USB Development]     [Video for Linux]     [Linux Audio Users]     [Linux SCSI]     [Yosemite News]

  •   Powered by Linux