Re: [PATCH 3/4] drm/msm: Fix debugfs deadlock

Doug Anderson
2021-03-31T23:14:07Z

Hi,

On Wed, Mar 31, 2021 at 3:14 PM Rob Clark <robdclark@gmail.com> wrote:
>
> @@ -111,23 +111,15 @@ static const struct file_operations msm_gpu_fops = {
> static int msm_gem_show(struct drm_device *dev, struct seq_file *m)
> {
> struct msm_drm_private *priv = dev->dev_private;
> - struct msm_gpu *gpu = priv->gpu;
> int ret;
>
> - ret = mutex_lock_interruptible(&priv->mm_lock);
> + ret = mutex_lock_interruptible(&priv->obj_lock);
> if (ret)
> return ret;
>
> - if (gpu) {
> - seq_printf(m, "Active Objects (%s):\n", gpu->name);
> - msm_gem_describe_objects(&gpu->active_list, m);
> - }
> -
> - seq_printf(m, "Inactive Objects:\n");
> - msm_gem_describe_objects(&priv->inactive_dontneed, m);
> - msm_gem_describe_objects(&priv->inactive_willneed, m);
> + msm_gem_describe_objects(&priv->objects, m);

I guess we no longer sort the by Active and Inactive but that doesn't
really matter?

> @@ -174,7 +174,13 @@ struct msm_drm_private {
> struct msm_rd_state *hangrd; /* debugfs to dump hanging submits */
> struct msm_perf_state *perf;
>
> - /*
> + /**
> + * List of all GEM objects (mainly for debugfs, protected by obj_lock

It wouldn't hurt to talk about lock ordering here? Like: "If we need
the "obj_lock" and a "gem_lock" at the same time we always grab the
"obj_lock" first.

> @@ -60,13 +60,20 @@ struct msm_gem_object {
> */
> uint8_t vmap_count;
>
> - /* And object is either:
> - * inactive - on priv->inactive_list
> + /**
> + * Node in list of all objects (mainly for debugfs, protected by
> + * struct_mutex

Not "struct_mutex" in comment, right? Maybe "obj_lock" I think?

-Doug