A few fixes for issues that I have seen in recovery path. The fix in lib/string is probably not needed anymore with the fixes in drm/msm, but I added it here nonetheless as it is good to have.
Sharat Masetty (3): lib/string: Pass the input gfp flags to kmalloc drm/msm: Check if target supports crash dump capture drm/msm: Fix task dump in gpu recovery
drivers/gpu/drm/msm/msm_gpu.c | 13 ++++++++----- lib/string_helpers.c | 4 ++-- 2 files changed, 10 insertions(+), 7 deletions(-)
-- 1.9.1
Pass the user sent gfp flags to kmalloc() calls. This helps calling the functions in user desired contexts.
Signed-off-by: Sharat Masetty smasetty@codeaurora.org --- lib/string_helpers.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/lib/string_helpers.c b/lib/string_helpers.c index 29c490e..60f9015 100644 --- a/lib/string_helpers.c +++ b/lib/string_helpers.c @@ -576,7 +576,7 @@ char *kstrdup_quotable_cmdline(struct task_struct *task, gfp_t gfp) char *buffer, *quoted; int i, res;
- buffer = kmalloc(PAGE_SIZE, GFP_KERNEL); + buffer = kmalloc(PAGE_SIZE, gfp); if (!buffer) return NULL;
@@ -612,7 +612,7 @@ char *kstrdup_quotable_file(struct file *file, gfp_t gfp) return kstrdup("<unknown>", gfp);
/* We add 11 spaces for ' (deleted)' to be appended */ - temp = kmalloc(PATH_MAX + 11, GFP_KERNEL); + temp = kmalloc(PATH_MAX + 11, gfp); if (!temp) return kstrdup("<no_memory>", gfp);
Thanks, I've pushed 2 and 3 to msm-next, since these should probably go in a -fixes pr for 4.20
This one, you might want to resend w/ --cc-cmd=./scripts/get_maintainer.pl so that it gets seen by someone who could apply it
fwiw, I use
git config sendemail.cccmd './scripts/get_maintainer.pl -i'
to make that automatic, but to give me a way to edit the list of cc's that get_maintainer.pl adds
BR, -R
On Fri, Oct 12, 2018 at 4:57 AM Sharat Masetty smasetty@codeaurora.org wrote:
Pass the user sent gfp flags to kmalloc() calls. This helps calling the functions in user desired contexts.
Signed-off-by: Sharat Masetty smasetty@codeaurora.org
lib/string_helpers.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/lib/string_helpers.c b/lib/string_helpers.c index 29c490e..60f9015 100644 --- a/lib/string_helpers.c +++ b/lib/string_helpers.c @@ -576,7 +576,7 @@ char *kstrdup_quotable_cmdline(struct task_struct *task, gfp_t gfp) char *buffer, *quoted; int i, res;
buffer = kmalloc(PAGE_SIZE, GFP_KERNEL);
buffer = kmalloc(PAGE_SIZE, gfp); if (!buffer) return NULL;
@@ -612,7 +612,7 @@ char *kstrdup_quotable_file(struct file *file, gfp_t gfp) return kstrdup("<unknown>", gfp);
/* We add 11 spaces for ' (deleted)' to be appended */
temp = kmalloc(PATH_MAX + 11, GFP_KERNEL);
temp = kmalloc(PATH_MAX + 11, gfp); if (!temp) return kstrdup("<no_memory>", gfp);
-- 1.9.1
Freedreno mailing list Freedreno@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/freedreno
This patch simply checks first to see if the target can support crash dump capture before proceeding.
Signed-off-by: Sharat Masetty smasetty@codeaurora.org --- drivers/gpu/drm/msm/msm_gpu.c | 4 ++++ 1 file changed, 4 insertions(+)
diff --git a/drivers/gpu/drm/msm/msm_gpu.c b/drivers/gpu/drm/msm/msm_gpu.c index 19b4afe..da63d3d 100644 --- a/drivers/gpu/drm/msm/msm_gpu.c +++ b/drivers/gpu/drm/msm/msm_gpu.c @@ -345,6 +345,10 @@ static void msm_gpu_crashstate_capture(struct msm_gpu *gpu, { struct msm_gpu_state *state;
+ /* Check if the target supports capturing crash state */ + if (!gpu->funcs->gpu_state_get) + return; + /* Only save one crash state at a time */ if (gpu->crashstate) return;
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 --- drivers/gpu/drm/msm/msm_gpu.c | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-)
diff --git a/drivers/gpu/drm/msm/msm_gpu.c b/drivers/gpu/drm/msm/msm_gpu.c index da63d3d..ca573f6 100644 --- a/drivers/gpu/drm/msm/msm_gpu.c +++ b/drivers/gpu/drm/msm/msm_gpu.c @@ -438,10 +438,9 @@ 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) { - comm = kstrdup(task->comm, GFP_ATOMIC); + comm = kstrdup(task->comm, GFP_KERNEL);
/* * So slightly annoying, in other paths like @@ -454,10 +453,10 @@ static void recover_worker(struct work_struct *work) * about the submit going away. */ mutex_unlock(&dev->struct_mutex); - cmd = kstrdup_quotable_cmdline(task, GFP_ATOMIC); + cmd = kstrdup_quotable_cmdline(task, GFP_KERNEL); + put_task_struct(task); mutex_lock(&dev->struct_mutex); } - rcu_read_unlock();
if (comm && cmd) { dev_err(dev->dev, "%s: offending task: %s (%s)\n",
dri-devel@lists.freedesktop.org