AMD-GFX Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: "Christian König" <ckoenig.leichtzumerken-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
To: Andrey Grodzovsky
	<andrey.grodzovsky-5C7GfCeVMHo@public.gmane.org>,
	amd-gfx-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org
Cc: alexdeucher-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org,
	Hawking.Zhang-5C7GfCeVMHo@public.gmane.org
Subject: Re: [PATCH 2/2] dmr/amdgpu: Add system auto reboot to RAS.
Date: Thu, 29 Aug 2019 09:33:25 +0200	[thread overview]
Message-ID: <a78daf14-7a90-737f-7151-97dd2dbccc80@gmail.com> (raw)
In-Reply-To: <1567022426-6612-2-git-send-email-andrey.grodzovsky-5C7GfCeVMHo@public.gmane.org>

Am 28.08.19 um 22:00 schrieb Andrey Grodzovsky:
> In case of RAS error allow user configure auto system
> reboot through ras_ctrl.
> This is also part of the temproray work around for the RAS
> hang problem.
>
> Signed-off-by: Andrey Grodzovsky <andrey.grodzovsky@amd.com>
> ---
>   drivers/gpu/drm/amd/amdgpu/amdgpu_device.c | 18 ++++++++++++++++++
>   drivers/gpu/drm/amd/amdgpu/amdgpu_ras.c    | 10 +++++++++-
>   drivers/gpu/drm/amd/amdgpu/amdgpu_ras.h    |  1 +
>   3 files changed, 28 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c
> index 3ecee10..f1cff47 100644
> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c
> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c
> @@ -3805,6 +3805,24 @@ int amdgpu_device_gpu_recover(struct amdgpu_device *adev,
>   	int i, r = 0;
>   	bool in_ras_intr = amdgpu_ras_intr_triggered();
>   
> +	/*
> +	 * Flush RAM to disk so that after reboot
> +	 * the user can read log and see why the system rebooted.
> +	 *
> +	 * Using user mode app call instead of kernel APIs such as
> +	 * ksys_sync_helper for backward comparability with earlier
> +	 * kernels into which this is also intended.
> +	 */
> +	if (in_ras_intr && amdgpu_ras_get_context(adev)->reboot) {
> +		char *envp[] = { "HOME=/", NULL };
> +		char *argv[] = { "/bin/sync", NULL };
> +
> +		DRM_WARN("Emergency reboot.");
> +
> +		call_usermodehelper(argv[0], argv, envp, UMH_WAIT_PROC);
> +		emergency_restart();
> +	}
> +
>   	need_full_reset = job_signaled = false;
>   	INIT_LIST_HEAD(&device_list);
>   
> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_ras.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_ras.c
> index 086e6df..423a1ba 100644
> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_ras.c
> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_ras.c
> @@ -30,6 +30,7 @@
>   #include "amdgpu_ras.h"
>   #include "amdgpu_atomfirmware.h"
>   #include "ivsrcid/nbio/irqsrcs_nbif_7_4.h"
> +#include <linux/kmod.h>
>   
>   const char *ras_error_string[] = {
>   	"none",
> @@ -154,6 +155,8 @@ static int amdgpu_ras_debugfs_ctrl_parse_data(struct file *f,
>   		op = 1;
>   	else if (sscanf(str, "inject %32s %8s", block_name, err) == 2)
>   		op = 2;
> +	else if (sscanf(str, "reboot %32s", block_name) == 1)
> +		op = 3;
>   	else if (str[0] && str[1] && str[2] && str[3])
>   		/* ascii string, but commands are not matched. */
>   		return -EINVAL;

This is actually becoming quite a mess. We should consider removing the 
parsing in the long term and using separate debugfs files for each action.

Christian.

> @@ -287,6 +290,9 @@ static ssize_t amdgpu_ras_debugfs_ctrl_write(struct file *f, const char __user *
>   		/* data.inject.address is offset instead of absolute gpu address */
>   		ret = amdgpu_ras_error_inject(adev, &data.inject);
>   		break;
> +	case 3:
> +		amdgpu_ras_get_context(adev)->reboot = true;
> +		break;
>   	default:
>   		ret = -EINVAL;
>   		break;
> @@ -1733,6 +1739,8 @@ int amdgpu_ras_fini(struct amdgpu_device *adev)
>   void amdgpu_ras_global_ras_isr(struct amdgpu_device *adev)
>   {
>   	if (atomic_cmpxchg(&amdgpu_ras_in_intr, 0, 1) == 0) {
> -		DRM_WARN("RAS event of type ERREVENT_ATHUB_INTERRUPT detected! Stopping all GPU jobs.\n");
> +		DRM_WARN("RAS event of type ERREVENT_ATHUB_INTERRUPT detected!\n");
> +
> +		amdgpu_ras_reset_gpu(adev, false);
>   	}
>   }
> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_ras.h b/drivers/gpu/drm/amd/amdgpu/amdgpu_ras.h
> index c0e22af..e3f0764 100644
> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_ras.h
> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_ras.h
> @@ -333,6 +333,7 @@ struct amdgpu_ras {
>   	struct mutex recovery_lock;
>   
>   	uint32_t flags;
> +	bool reboot;
>   };
>   
>   struct ras_fs_data {

_______________________________________________
amd-gfx mailing list
amd-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

  parent reply	other threads:[~2019-08-29  7:33 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-08-28 20:00 [PATCH 1/2] dmr/amdgpu: Avoid HW GPU reset for RAS Andrey Grodzovsky
     [not found] ` <1567022426-6612-1-git-send-email-andrey.grodzovsky-5C7GfCeVMHo@public.gmane.org>
2019-08-28 20:00   ` [PATCH 2/2] dmr/amdgpu: Add system auto reboot to RAS Andrey Grodzovsky
     [not found]     ` <1567022426-6612-2-git-send-email-andrey.grodzovsky-5C7GfCeVMHo@public.gmane.org>
2019-08-29  7:33       ` Christian König [this message]
2019-08-28 21:18   ` [PATCH 1/2] dmr/amdgpu: Avoid HW GPU reset for RAS Kuehling, Felix
     [not found]     ` <5cf4dfa5-705c-9c10-8ca1-bf9cc21c1529-5C7GfCeVMHo@public.gmane.org>
2019-08-28 21:30       ` Grodzovsky, Andrey
2019-08-29  7:30   ` Christian König
     [not found]     ` <85798da5-a4f1-28d3-c80f-9f262743cac9-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2019-08-29 14:03       ` Grodzovsky, Andrey
     [not found]         ` <9a46188b-b528-0d1f-8c3f-b6ce5b73649f-5C7GfCeVMHo@public.gmane.org>
2019-08-29 14:06           ` Koenig, Christian
     [not found]             ` <8c2b0bf3-47ff-ea3b-a682-7ec76240be4d-5C7GfCeVMHo@public.gmane.org>
2019-08-29 14:08               ` Grodzovsky, Andrey
     [not found]                 ` <1444ae5f-0997-d1ce-3e1e-23fea8822c88-5C7GfCeVMHo@public.gmane.org>
2019-08-29 16:18                   ` Kuehling, Felix
     [not found]                     ` <3a39a720-ae2d-0019-aecc-422f0e3f27bb-5C7GfCeVMHo@public.gmane.org>
2019-08-29 17:21                       ` Grodzovsky, Andrey
     [not found]                         ` <2763a85d-cfd7-bf80-5d8b-3590cf35e6d0-5C7GfCeVMHo@public.gmane.org>
2019-08-29 19:09                           ` Kuehling, Felix
2019-08-29  7:56   ` Zhou1, Tao
     [not found]     ` <MN2PR12MB305484B7D854243654C06EBDB0A20-rweVpJHSKTqnT25eLM+iUQdYzm3356FpvxpqHgZTriW3zl9H0oFU5g@public.gmane.org>
2019-08-29 14:19       ` Grodzovsky, Andrey

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=a78daf14-7a90-737f-7151-97dd2dbccc80@gmail.com \
    --to=ckoenig.leichtzumerken-re5jqeeqqe8avxtiumwx3w@public.gmane.org \
    --cc=Hawking.Zhang-5C7GfCeVMHo@public.gmane.org \
    --cc=alexdeucher-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org \
    --cc=amd-gfx-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org \
    --cc=andrey.grodzovsky-5C7GfCeVMHo@public.gmane.org \
    --cc=christian.koenig-5C7GfCeVMHo@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox