* [PATCH 0/3] drm/msm: Fix gpu recovery path
@ 2018-10-12 8:56 Sharat Masetty
[not found] ` <1539334616-11723-1-git-send-email-smasetty-sgV2jX0FEOL9JmXXK+q4OQ@public.gmane.org>
0 siblings, 1 reply; 5+ messages in thread
From: Sharat Masetty @ 2018-10-12 8:56 UTC (permalink / raw)
To: freedreno-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW
Cc: linux-arm-msm-u79uwXL29TY76Z2rM5mHXA,
jcrouse-sgV2jX0FEOL9JmXXK+q4OQ, Sharat Masetty,
dri-devel-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW
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
_______________________________________________
Freedreno mailing list
Freedreno@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/freedreno
^ permalink raw reply [flat|nested] 5+ messages in thread
* [PATCH 1/3] lib/string: Pass the input gfp flags to kmalloc
[not found] ` <1539334616-11723-1-git-send-email-smasetty-sgV2jX0FEOL9JmXXK+q4OQ@public.gmane.org>
@ 2018-10-12 8:56 ` Sharat Masetty
[not found] ` <1539334616-11723-2-git-send-email-smasetty-sgV2jX0FEOL9JmXXK+q4OQ@public.gmane.org>
2018-10-12 8:56 ` [PATCH 2/3] drm/msm: Check if target supports crash dump capture Sharat Masetty
2018-10-12 8:56 ` [PATCH 3/3] drm/msm: Fix task dump in gpu recovery Sharat Masetty
2 siblings, 1 reply; 5+ messages in thread
From: Sharat Masetty @ 2018-10-12 8:56 UTC (permalink / raw)
To: freedreno-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW
Cc: linux-arm-msm-u79uwXL29TY76Z2rM5mHXA,
jcrouse-sgV2jX0FEOL9JmXXK+q4OQ, Sharat Masetty,
dri-devel-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW
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
^ permalink raw reply related [flat|nested] 5+ messages in thread
* [PATCH 2/3] drm/msm: Check if target supports crash dump capture
[not found] ` <1539334616-11723-1-git-send-email-smasetty-sgV2jX0FEOL9JmXXK+q4OQ@public.gmane.org>
2018-10-12 8:56 ` [PATCH 1/3] lib/string: Pass the input gfp flags to kmalloc Sharat Masetty
@ 2018-10-12 8:56 ` Sharat Masetty
2018-10-12 8:56 ` [PATCH 3/3] drm/msm: Fix task dump in gpu recovery Sharat Masetty
2 siblings, 0 replies; 5+ messages in thread
From: Sharat Masetty @ 2018-10-12 8:56 UTC (permalink / raw)
To: freedreno-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW
Cc: linux-arm-msm-u79uwXL29TY76Z2rM5mHXA,
jcrouse-sgV2jX0FEOL9JmXXK+q4OQ, Sharat Masetty,
dri-devel-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW
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;
--
1.9.1
_______________________________________________
Freedreno mailing list
Freedreno@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/freedreno
^ permalink raw reply related [flat|nested] 5+ messages in thread
* [PATCH 3/3] drm/msm: Fix task dump in gpu recovery
[not found] ` <1539334616-11723-1-git-send-email-smasetty-sgV2jX0FEOL9JmXXK+q4OQ@public.gmane.org>
2018-10-12 8:56 ` [PATCH 1/3] lib/string: Pass the input gfp flags to kmalloc Sharat Masetty
2018-10-12 8:56 ` [PATCH 2/3] drm/msm: Check if target supports crash dump capture Sharat Masetty
@ 2018-10-12 8:56 ` Sharat Masetty
2 siblings, 0 replies; 5+ messages in thread
From: Sharat Masetty @ 2018-10-12 8:56 UTC (permalink / raw)
To: freedreno-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW
Cc: linux-arm-msm-u79uwXL29TY76Z2rM5mHXA,
jcrouse-sgV2jX0FEOL9JmXXK+q4OQ, Sharat Masetty,
dri-devel-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW
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",
--
1.9.1
_______________________________________________
Freedreno mailing list
Freedreno@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/freedreno
^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [PATCH 1/3] lib/string: Pass the input gfp flags to kmalloc
[not found] ` <1539334616-11723-2-git-send-email-smasetty-sgV2jX0FEOL9JmXXK+q4OQ@public.gmane.org>
@ 2018-10-12 13:02 ` Rob Clark
0 siblings, 0 replies; 5+ messages in thread
From: Rob Clark @ 2018-10-12 13:02 UTC (permalink / raw)
To: Sharat Masetty; +Cc: linux-arm-msm, Jordan Crouse, freedreno, dri-devel
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
_______________________________________________
Freedreno mailing list
Freedreno@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/freedreno
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2018-10-12 13:02 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-10-12 8:56 [PATCH 0/3] drm/msm: Fix gpu recovery path Sharat Masetty
[not found] ` <1539334616-11723-1-git-send-email-smasetty-sgV2jX0FEOL9JmXXK+q4OQ@public.gmane.org>
2018-10-12 8:56 ` [PATCH 1/3] lib/string: Pass the input gfp flags to kmalloc Sharat Masetty
[not found] ` <1539334616-11723-2-git-send-email-smasetty-sgV2jX0FEOL9JmXXK+q4OQ@public.gmane.org>
2018-10-12 13:02 ` Rob Clark
2018-10-12 8:56 ` [PATCH 2/3] drm/msm: Check if target supports crash dump capture Sharat Masetty
2018-10-12 8:56 ` [PATCH 3/3] drm/msm: Fix task dump in gpu recovery Sharat Masetty
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).