]> git.proxmox.com Git - mirror_ubuntu-bionic-kernel.git/commitdiff
drm/msm: Fix task dump in gpu recovery
authorSharat Masetty <smasetty@codeaurora.org>
Fri, 12 Oct 2018 08:56:56 +0000 (14:26 +0530)
committerKleber Sacilotto de Souza <kleber.souza@canonical.com>
Wed, 14 Aug 2019 09:18:49 +0000 (11:18 +0200)
BugLink: https://bugs.launchpad.net/bugs/1837257
[ Upstream commit 482f96324a4e08818db7d75bb12beaaea6c9561d ]

The current recovery code gets a pointer to the task struct and does a
few things all within the rcu_read_lock. This puts constraints on the
types of gfp flags that can be used within the rcu lock. This patch
instead gets a reference to the task within the rcu lock and releases
the lock immediately, this way the task stays afloat until we need it and
we also get to use the desired gfp flags.

Signed-off-by: Sharat Masetty <smasetty@codeaurora.org>
Signed-off-by: Rob Clark <robdclark@gmail.com>
Signed-off-by: Sean Paul <seanpaul@chromium.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
Signed-off-by: Andrea Righi <andrea.righi@canonical.com>
Signed-off-by: Khalid Elmously <khalid.elmously@canonical.com>
drivers/gpu/drm/msm/msm_gpu.c

index 984816556bf0bcb5effd38e8ae4870cd7802cc6e..d4c3fb0b3669d2217edf63065117c47f0b02725a 100644 (file)
@@ -270,8 +270,7 @@ static void recover_worker(struct work_struct *work)
        if (submit) {
                struct task_struct *task;
 
-               rcu_read_lock();
-               task = pid_task(submit->pid, PIDTYPE_PID);
+               task = get_pid_task(submit->pid, PIDTYPE_PID);
                if (task) {
                        char *cmd;
 
@@ -287,6 +286,7 @@ static void recover_worker(struct work_struct *work)
                         */
                        mutex_unlock(&dev->struct_mutex);
                        cmd = kstrdup_quotable_cmdline(task, GFP_KERNEL);
+                       put_task_struct(task);
                        mutex_lock(&dev->struct_mutex);
 
                        dev_err(dev->dev, "%s: offending task: %s (%s)\n",
@@ -297,7 +297,6 @@ static void recover_worker(struct work_struct *work)
                } else {
                        msm_rd_dump_submit(priv->hangrd, submit, NULL);
                }
-               rcu_read_unlock();
        }