All of lore.kernel.org
 help / color / mirror / Atom feed
From: Oded Gabbay <oded.gabbay-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
To: Felix Kuehling <Felix.Kuehling-5C7GfCeVMHo@public.gmane.org>
Cc: Philip Yang <Philip.Yang-5C7GfCeVMHo@public.gmane.org>,
	amd-gfx list
	<amd-gfx-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org>
Subject: Re: [PATCH 02/14] drm/amdkfd: Add crash protection in debugger register path
Date: Thu, 30 Nov 2017 18:14:26 +0200	[thread overview]
Message-ID: <CAFCwf13oD7Czpz7HE75mY0EUFsdzXdt2MnjdEm0eFQC_Srx3og@mail.gmail.com> (raw)
In-Reply-To: <1511825396-24579-3-git-send-email-Felix.Kuehling-5C7GfCeVMHo@public.gmane.org>

On Tue, Nov 28, 2017 at 1:29 AM, Felix Kuehling <Felix.Kuehling@amd.com> wrote:
> From: Philip Yang <Philip.Yang@amd.com>
>
> After debugger is registered, the pqm_destroy_queue fails because is_debug
> is true, the queue should not be removed from process_queue_list since
> the count is not reduced.
>
> Test application calls debugger unregister without register debugger, add
> null pointer check protection to avoid crash for this case
>
> Signed-off-by: Philip Yang <Philip.Yang@amd.com>
> Signed-off-by: Felix Kuehling <Felix.Kuehling@amd.com>
> ---
>  drivers/gpu/drm/amd/amdkfd/kfd_chardev.c               | 2 +-
>  drivers/gpu/drm/amd/amdkfd/kfd_process_queue_manager.c | 5 +++++
>  2 files changed, 6 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/gpu/drm/amd/amdkfd/kfd_chardev.c b/drivers/gpu/drm/amd/amdkfd/kfd_chardev.c
> index cc61ec2..62c3d9c 100644
> --- a/drivers/gpu/drm/amd/amdkfd/kfd_chardev.c
> +++ b/drivers/gpu/drm/amd/amdkfd/kfd_chardev.c
> @@ -526,7 +526,7 @@ static int kfd_ioctl_dbg_unregister(struct file *filep,
>         long status;
>
>         dev = kfd_device_by_id(args->gpu_id);
> -       if (!dev)
> +       if (!dev || !dev->dbgmgr)
>                 return -EINVAL;
>
>         if (dev->device_info->asic_family == CHIP_CARRIZO) {
> diff --git a/drivers/gpu/drm/amd/amdkfd/kfd_process_queue_manager.c b/drivers/gpu/drm/amd/amdkfd/kfd_process_queue_manager.c
> index eeb7726..2c98858 100644
> --- a/drivers/gpu/drm/amd/amdkfd/kfd_process_queue_manager.c
> +++ b/drivers/gpu/drm/amd/amdkfd/kfd_process_queue_manager.c
> @@ -313,6 +313,10 @@ int pqm_destroy_queue(struct process_queue_manager *pqm, unsigned int qid)
>         if (pqn->q) {
>                 dqm = pqn->q->device->dqm;
>                 retval = dqm->ops.destroy_queue(dqm, &pdd->qpd, pqn->q);
> +               if (retval) {
> +                       pr_debug("Destroy queue failed, returned %d\n", retval);
> +                       goto err_destroy_queue;
> +               }
>                 uninit_queue(pqn->q);
>         }
>
> @@ -324,6 +328,7 @@ int pqm_destroy_queue(struct process_queue_manager *pqm, unsigned int qid)
>             list_empty(&pdd->qpd.priv_queue_list))
>                 dqm->ops.unregister_process(dqm, &pdd->qpd);
>
> +err_destroy_queue:
>         return retval;
>  }
>
> --
> 2.7.4
>
This patch is:
Reviewed-by: Oded Gabbay <oded.gabbay@gmail.com>
_______________________________________________
amd-gfx mailing list
amd-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

  parent reply	other threads:[~2017-11-30 16:14 UTC|newest]

Thread overview: 35+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-11-27 23:29 [PATCH 00/14] KFD upstreaming 20171127 Felix Kuehling
     [not found] ` <1511825396-24579-1-git-send-email-Felix.Kuehling-5C7GfCeVMHo@public.gmane.org>
2017-11-27 23:29   ` [PATCH 01/14] drm/amdgpu: fix get_max_engine_clock_in_mhz Felix Kuehling
     [not found]     ` <1511825396-24579-2-git-send-email-Felix.Kuehling-5C7GfCeVMHo@public.gmane.org>
2017-11-30 16:03       ` Oded Gabbay
2017-11-27 23:29   ` [PATCH 02/14] drm/amdkfd: Add crash protection in debugger register path Felix Kuehling
     [not found]     ` <1511825396-24579-3-git-send-email-Felix.Kuehling-5C7GfCeVMHo@public.gmane.org>
2017-11-30 16:14       ` Oded Gabbay [this message]
2017-11-27 23:29   ` [PATCH 03/14] drm/amdkfd: map multiple processes to HW scheduler Felix Kuehling
     [not found]     ` <1511825396-24579-4-git-send-email-Felix.Kuehling-5C7GfCeVMHo@public.gmane.org>
2017-12-05  8:04       ` Oded Gabbay
2017-11-27 23:29   ` [PATCH 04/14] drm/amdkfd: Fix oversubscription accounting Felix Kuehling
     [not found]     ` <1511825396-24579-5-git-send-email-Felix.Kuehling-5C7GfCeVMHo@public.gmane.org>
2017-12-05  8:10       ` Oded Gabbay
     [not found]         ` <CAFCwf11eM8pYmBOHdD1o4NVDj9nesJwp3Ny9dGukzstM5iP=Ag-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2017-12-05 19:27           ` Felix Kuehling
     [not found]             ` <9f625c72-a44e-6560-1d2b-6d998ad0e2e2-5C7GfCeVMHo@public.gmane.org>
2017-12-10  9:00               ` Oded Gabbay
2017-11-27 23:29   ` [PATCH 05/14] drm/amdgpu: Fix definition of KFD_CIK_SDMA_QUEUE_OFFSET Felix Kuehling
     [not found]     ` <1511825396-24579-6-git-send-email-Felix.Kuehling-5C7GfCeVMHo@public.gmane.org>
2017-12-05  8:15       ` Oded Gabbay
2017-11-27 23:29   ` [PATCH 06/14] drm/amdgpu: Add kfd2kgd APIs for dumping HQDs Felix Kuehling
     [not found]     ` <1511825396-24579-7-git-send-email-Felix.Kuehling-5C7GfCeVMHo@public.gmane.org>
2017-12-05  8:23       ` Oded Gabbay
2017-11-27 23:29   ` [PATCH 07/14] drm/amdkfd: Add debugfs support to KFD Felix Kuehling
     [not found]     ` <1511825396-24579-8-git-send-email-Felix.Kuehling-5C7GfCeVMHo@public.gmane.org>
2017-12-05  8:27       ` Oded Gabbay
2017-11-27 23:29   ` [PATCH 08/14] drm/amdkfd: Get reference to lead_thread task struct Felix Kuehling
     [not found]     ` <1511825396-24579-9-git-send-email-Felix.Kuehling-5C7GfCeVMHo@public.gmane.org>
2017-12-05  8:43       ` Oded Gabbay
     [not found]         ` <CAFCwf12ELNgXW7bL+zb2F3v1XWn914maeRP3e3M+3U15B521wg-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2017-12-05 19:14           ` Felix Kuehling
     [not found]             ` <e23118b1-eb9b-6a2b-e937-09747b4a9aac-5C7GfCeVMHo@public.gmane.org>
2017-12-10  9:04               ` Oded Gabbay
2017-11-27 23:29   ` [PATCH 09/14] drm/amdkfd: Make kfd_process reference counted Felix Kuehling
     [not found]     ` <1511825396-24579-10-git-send-email-Felix.Kuehling-5C7GfCeVMHo@public.gmane.org>
2017-12-10 10:00       ` Oded Gabbay
2017-11-27 23:29   ` [PATCH 10/14] drm/amdkfd: Use ref count to prevent kfd_process destruction Felix Kuehling
     [not found]     ` <1511825396-24579-11-git-send-email-Felix.Kuehling-5C7GfCeVMHo@public.gmane.org>
2017-11-28  9:52       ` Christian König
     [not found]         ` <7fb6a8a7-5616-95d6-c2c9-3b69a75a3613-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2017-12-01 21:17           ` Felix Kuehling
     [not found]             ` <ab143937-aca3-9f3e-b6f4-4d354fde3c05-5C7GfCeVMHo@public.gmane.org>
2017-12-10  9:59               ` Oded Gabbay
2017-11-27 23:29   ` [PATCH 11/14] drm/amdkfd: Return NULL if kfd_lookup_process_by_pasid fails Felix Kuehling
     [not found]     ` <1511825396-24579-12-git-send-email-Felix.Kuehling-5C7GfCeVMHo@public.gmane.org>
2017-12-10 10:12       ` Oded Gabbay
2017-11-27 23:29   ` [PATCH 12/14] drm/amdkfd: Reduce nesting in kfd_create_process_device_data Felix Kuehling
     [not found]     ` <1511825396-24579-13-git-send-email-Felix.Kuehling-5C7GfCeVMHo@public.gmane.org>
2017-12-10 10:13       ` Oded Gabbay
2017-11-27 23:29   ` [PATCH 13/14] drm/amdkfd: Factor PDD destruction out of kfd_process_wq_release Felix Kuehling
     [not found]     ` <1511825396-24579-14-git-send-email-Felix.Kuehling-5C7GfCeVMHo@public.gmane.org>
2017-12-10 10:15       ` Oded Gabbay
2017-11-27 23:29   ` [PATCH 14/14] drm/amdkfd: Simplify locking during process creation Felix Kuehling
     [not found]     ` <1511825396-24579-15-git-send-email-Felix.Kuehling-5C7GfCeVMHo@public.gmane.org>
2017-12-10 10:22       ` Oded Gabbay

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=CAFCwf13oD7Czpz7HE75mY0EUFsdzXdt2MnjdEm0eFQC_Srx3og@mail.gmail.com \
    --to=oded.gabbay-re5jqeeqqe8avxtiumwx3w@public.gmane.org \
    --cc=Felix.Kuehling-5C7GfCeVMHo@public.gmane.org \
    --cc=Philip.Yang-5C7GfCeVMHo@public.gmane.org \
    --cc=amd-gfx-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.