From: zhoucm1 <david1.zhou-5C7GfCeVMHo@public.gmane.org>
To: "Christian König"
<deathsimple-ANTagKRnAhcb1SvskN2V4Q@public.gmane.org>,
amd-gfx-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org
Subject: Re: [PATCH 1/4] drm/amdgpu: check if vram is lost v2
Date: Wed, 17 May 2017 12:37:07 +0800 [thread overview]
Message-ID: <591BD373.9020501@amd.com> (raw)
In-Reply-To: <0c1d89c5-65ea-cdad-100a-80d0377b865c-ANTagKRnAhcb1SvskN2V4Q@public.gmane.org>
On 2017年05月16日 18:49, Christian König wrote:
> Am 16.05.2017 um 11:25 schrieb Chunming Zhou:
>> bakup first 64 byte of gart table as reset magic, check if magic is same
>> after gpu hw reset.
>> v2: use memcmp instead of manual innovation.
>>
>> Change-Id: I9a73720da4084ea8677c3031dfb62e8157ee5704
>> Signed-off-by: Chunming Zhou <David1.Zhou@amd.com>
>
> Patch #1-#3 are Reviewed-by: Christian König <christian.koenig@amd.com>
pushed.
>
> Patch #4:
>
> You need to add the new enum on line 591 or otherwise you will get an
> "unsupported operation" error.
>
> Line 604 should be changed as well or otherwise we need a BO for this
> operation.
are you sure you are talking this patch#4? I cannot address what you said.
>
> A libdrm test case to just call this IOCTL would probably be a good idea.
>
> Additional to that I would ping Marek (Mesa) and Michel (DDX) for
> their opinion on this. Could be that this is completely superfluous
> and the UMDs needs something else.
Michel seems have different opinion/concern, maybe we need more
discussions before we make new interfaces.
Thanks,
David Zhou
>
> Regards,
> Christian.
>
>> ---
>> drivers/gpu/drm/amd/amdgpu/amdgpu.h | 2 ++
>> drivers/gpu/drm/amd/amdgpu/amdgpu_device.c | 20 +++++++++++++++++++-
>> 2 files changed, 21 insertions(+), 1 deletion(-)
>>
>> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu.h
>> b/drivers/gpu/drm/amd/amdgpu/amdgpu.h
>> index de08ff0..f9da215 100644
>> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu.h
>> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu.h
>> @@ -1502,6 +1502,7 @@ struct amdgpu_ssg {
>> #endif
>> };
>> +#define AMDGPU_RESET_MAGIC_NUM 64
>> struct amdgpu_device {
>> struct device *dev;
>> struct drm_device *ddev;
>> @@ -1705,6 +1706,7 @@ struct amdgpu_device {
>> /* record hw reset is performed */
>> bool has_hw_reset;
>> + u8 reset_magic[AMDGPU_RESET_MAGIC_NUM];
>> };
>> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c
>> b/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c
>> index 0a31fb1..c56ae4a 100644
>> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c
>> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c
>> @@ -1685,6 +1685,17 @@ static int amdgpu_init(struct amdgpu_device
>> *adev)
>> return 0;
>> }
>> +static void amdgpu_fill_reset_magic(struct amdgpu_device *adev)
>> +{
>> + memcpy(adev->reset_magic, adev->gart.ptr, AMDGPU_RESET_MAGIC_NUM);
>> +}
>> +
>> +static bool amdgpu_check_vram_lost(struct amdgpu_device *adev)
>> +{
>> + return !!memcmp(adev->gart.ptr, adev->reset_magic,
>> + AMDGPU_RESET_MAGIC_NUM);
>> +}
>> +
>> static int amdgpu_late_init(struct amdgpu_device *adev)
>> {
>> int i = 0, r;
>> @@ -1715,6 +1726,8 @@ static int amdgpu_late_init(struct
>> amdgpu_device *adev)
>> }
>> }
>> + amdgpu_fill_reset_magic(adev);
>> +
>> return 0;
>> }
>> @@ -2830,7 +2843,7 @@ int amdgpu_gpu_reset(struct amdgpu_device *adev)
>> struct drm_atomic_state *state = NULL;
>> int i, r;
>> int resched;
>> - bool need_full_reset;
>> + bool need_full_reset, vram_lost = false;
>> if (amdgpu_sriov_vf(adev))
>> return amdgpu_sriov_gpu_reset(adev, true);
>> @@ -2899,12 +2912,17 @@ int amdgpu_gpu_reset(struct amdgpu_device *adev)
>> r = amdgpu_resume_phase1(adev);
>> if (r)
>> goto out;
>> + vram_lost = amdgpu_check_vram_lost(adev);
>> + if (vram_lost)
>> + DRM_ERROR("VRAM is lost!\n");
>> r = amdgpu_ttm_recover_gart(adev);
>> if (r)
>> goto out;
>> r = amdgpu_resume_phase2(adev);
>> if (r)
>> goto out;
>> + if (vram_lost)
>> + amdgpu_fill_reset_magic(adev);
>> }
>> }
>> out:
>
>
_______________________________________________
amd-gfx mailing list
amd-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
prev parent reply other threads:[~2017-05-17 4:37 UTC|newest]
Thread overview: 22+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-05-16 9:25 [PATCH 1/4] drm/amdgpu: check if vram is lost v2 Chunming Zhou
[not found] ` <1494926750-1081-1-git-send-email-David1.Zhou-5C7GfCeVMHo@public.gmane.org>
2017-05-16 9:25 ` [PATCH 2/4] drm/amdgpu: return -ENODEV to user space when " Chunming Zhou
[not found] ` <1494926750-1081-2-git-send-email-David1.Zhou-5C7GfCeVMHo@public.gmane.org>
2017-05-23 15:08 ` Deucher, Alexander
[not found] ` <BN6PR12MB1652E1AFF691F58C92FC2CD7F7F90-/b2+HYfkarQqUD6E6FAiowdYzm3356FpvxpqHgZTriW3zl9H0oFU5g@public.gmane.org>
2017-05-23 15:16 ` Christian König
[not found] ` <69717c0b-b2c1-589a-c466-5d6be9518eda-ANTagKRnAhcb1SvskN2V4Q@public.gmane.org>
2017-05-24 2:20 ` zhoucm1
2017-05-16 9:25 ` [PATCH 3/4] drm/amdgpu: skip all jobs of guilty vm Chunming Zhou
2017-05-16 9:25 ` [PATCH 4/4] drm/amdgpu: reset fpriv vram_lost_counter Chunming Zhou
[not found] ` <1494926750-1081-4-git-send-email-David1.Zhou-5C7GfCeVMHo@public.gmane.org>
2017-05-17 1:18 ` Michel Dänzer
[not found] ` <58988726-543a-535a-3011-860d29b9f2da-otUistvHUpPR7s880joybQ@public.gmane.org>
2017-05-17 3:04 ` zhoucm1
[not found] ` <591BBDA2.1070900-5C7GfCeVMHo@public.gmane.org>
2017-05-17 3:15 ` Michel Dänzer
[not found] ` <29fe2142-7fd1-e23a-49d9-c38dc685db92-otUistvHUpPR7s880joybQ@public.gmane.org>
2017-05-17 4:28 ` zhoucm1
[not found] ` <591BD17C.8050903-5C7GfCeVMHo@public.gmane.org>
2017-05-17 6:57 ` Michel Dänzer
[not found] ` <7d87bc8e-9c09-ad25-de6e-dfbd8116bf6e-otUistvHUpPR7s880joybQ@public.gmane.org>
2017-05-17 7:13 ` zhoucm1
[not found] ` <591BF825.6090505-5C7GfCeVMHo@public.gmane.org>
2017-05-17 8:01 ` Michel Dänzer
[not found] ` <31db7a30-dd98-5cb2-4125-187d3d0e2a49-otUistvHUpPR7s880joybQ@public.gmane.org>
2017-05-17 8:40 ` Christian König
[not found] ` <7a302ebe-1de1-734f-fb21-aadcc7904d37-ANTagKRnAhcb1SvskN2V4Q@public.gmane.org>
2017-05-17 8:46 ` zhoucm1
[not found] ` <591C0DFB.8030604-5C7GfCeVMHo@public.gmane.org>
2017-05-17 8:55 ` Michel Dänzer
2017-05-17 8:56 ` Christian König
[not found] ` <46582a1e-e019-34ac-1913-ed4a2a992e4c-ANTagKRnAhcb1SvskN2V4Q@public.gmane.org>
2017-05-17 9:49 ` Marek Olšák
[not found] ` <CAAxE2A7sRZXx3MnRSO76DW=61X06nfVs2AHe_a-r+K+46tfJPw-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2017-05-17 10:15 ` Zhou, David(ChunMing)
2017-05-16 10:49 ` [PATCH 1/4] drm/amdgpu: check if vram is lost v2 Christian König
[not found] ` <0c1d89c5-65ea-cdad-100a-80d0377b865c-ANTagKRnAhcb1SvskN2V4Q@public.gmane.org>
2017-05-17 4:37 ` zhoucm1 [this message]
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=591BD373.9020501@amd.com \
--to=david1.zhou-5c7gfcevmho@public.gmane.org \
--cc=amd-gfx-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org \
--cc=deathsimple-ANTagKRnAhcb1SvskN2V4Q@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