drm/amdgpu: fix modprobe failure of the 2nd GPU when GDDR6 training enabled
Subsystems (2)
PATCH 1/1 drm/amdgpu: fix modprobe failure of the 2nd GPU when GDDR6 training enabled
From: "Tianci.Yin" <[email protected]>
[why]
In dual GPUs scenario, stolen_size is assigned to zero on the 2nd GPU, then the bottom region of VRAM was allocated as GTT, unfortunately a small region of bottom VRAM was encroached by UMC firmware during GDDR6 BIST training, this cause pagefault.
[how]
Forcing stolen_size to 3MB, then the bottom region of VRAM was allocated as stolen memory, GTT corruption avoid.
The stolen memory of the 2nd GPU will be free in late_init phase, no memory wasted.
--- drivers/gpu/drm/amd/amdgpu/amdgpu_gmc.h | 6 ++++++ drivers/gpu/drm/amd/amdgpu/gmc_v10_0.c | 21 +++++++++++++++++++++ 2 files changed, 27 insertions(+)
drivers/gpu/drm/amd/amdgpu/amdgpu_gmc.h +6 -0
@@ -60,6 +60,11 @@*/ #define AMDGPU_GMC_FAULT_TIMEOUT 5000ULL +/* +* Default stolen memory size, 1024 * 768 * 4 +*/ +#define AMDGPU_STOLEN_VGA_DEFAULT_SIZE 0x300000 +struct firmware ;/*
@@ -192,6 +197,7 @@ struct amdgpu_gmc {uint32_t srbm_soft_reset;bool prt_warning;uint64_t stolen_size; +bool stolen_temp_reserved;/* apertures */ u64 shared_aperture_start;u64 shared_aperture_end;
drivers/gpu/drm/amd/amdgpu/gmc_v10_0.c +21 -0
@@ -566,6 +566,11 @@ static int gmc_v10_0_late_init(void *handle)struct amdgpu_device *adev = (struct amdgpu_device *)handle;int r; +if (adev->gmc.stolen_temp_reserved) { +amdgpu_bo_late_init (adev); + adev->gmc.stolen_temp_reserved = false; + } + r =amdgpu_gmc_allocate_vm_inv_eng (adev);if (r)return r;
@@ -756,6 +761,22 @@ static int gmc_v10_0_sw_init(void *handle)return r; adev->gmc.stolen_size =gmc_v10_0_get_vbios_fb_size (adev); +/* +* In dual GPUs scenario, stolen_size is assigned to zero on the 2nd GPU, +* then the bottom region of VRAM was allocated as GTT, unfortunately +* a small region of bottom VRAM was encroached by UMC firmware during +* GDDR6 BIST training, this cause pagefault. +* The page fault can be fixed by forcing stolen_size to 3MB, then the bottom +* region of VRAM was allocated as stolen memory, GTT corruption avoid. +* The stolen memory of the 2nd GPU will be free in late_init phase, +* no memory wasted. +*/ +if (adev->fw_vram_usage.mem_train_support && + adev->gmc.stolen_size ==0 ) { + adev->gmc.stolen_size =AMDGPU_STOLEN_VGA_DEFAULT_SIZE ; + adev->gmc.stolen_temp_reserved = true; + }else + adev->gmc.stolen_temp_reserved = false;/* Memory manager */ r =amdgpu_bo_init (adev);
Signature · 6 lines
2.17.1 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
Christian König
maintainerAm 08.01.20 um 13:36 schrieb Tianci Yin:
Quoted 7 lines
From: "Tianci.Yin" <[email protected]>
[why]
In dual GPUs scenario,stolen_sizeis assigned to zero on the 2nd GPU, then the bottom region of VRAM was allocated as GTT, unfortunately a small region of bottom VRAM was encroached by UMC firmware during GDDR6 BIST training, this cause pagefault.
What I'm missing here is why is the stolen size zero on the 2nd GPU?
Maybe we need to read the stolen size after posting the GPU instead?
Regards,
Christian.
Quoted 67 lines
[how]
Forcingstolen_sizeto 3MB, then the bottom region of VRAM was allocated as stolen memory, GTT corruption avoid.
The stolen memory of the 2nd GPU will be free inlate_initphase, no memory wasted.Change-Id Icd0ad7de41333282949bb1e3e676c6c307ddd081Signed-off-by Tianci.Yin <[email protected]>--- drivers/gpu/drm/amd/amdgpu/amdgpu_gmc.h | 6 ++++++ drivers/gpu/drm/amd/amdgpu/gmc_v10_0.c | 21 +++++++++++++++++++++ 2 files changed, 27 insertions(+)drivers/gpu/drm/amd/amdgpu/amdgpu_gmc.h +6
-0@@ -60,6 +60,11 @@*/ #define AMDGPU_GMC_FAULT_TIMEOUT 5000ULL +/* +* Default stolen memory size, 1024 * 768 * 4 +*/ +#define AMDGPU_STOLEN_VGA_DEFAULT_SIZE 0x300000 +struct firmware ;/* @@ -192,6 +197,7 @@ struct amdgpu_gmc {uint32_t srbm_soft_reset;bool prt_warning;uint64_t stolen_size; +bool stolen_temp_reserved;/* apertures */ u64 shared_aperture_start;u64 shared_aperture_end;drivers/gpu/drm/amd/amdgpu/gmc_v10_0.c +14
-0@@ -566,6 +566,11 @@ static int gmc_v10_0_late_init(void *handle)struct amdgpu_device *adev = (struct amdgpu_device *)handle;int r; +if (adev->gmc.stolen_temp_reserved) { +amdgpu_bo_late_init (adev); + adev->gmc.stolen_temp_reserved = false; + } + r =amdgpu_gmc_allocate_vm_inv_eng (adev);if (r)return r;@@ -756,6 +761,22 @@ static int gmc_v10_0_sw_init(void *handle)return r; adev->gmc.stolen_size =gmc_v10_0_get_vbios_fb_size (adev); +/* +* In dual GPUs scenario, stolen_size is assigned to zero on the 2nd GPU, +* then the bottom region of VRAM was allocated as GTT, unfortunately +* a small region of bottom VRAM was encroached by UMC firmware during +* GDDR6 BIST training, this cause pagefault. +* The page fault can be fixed by forcing stolen_size to 3MB, then the bottom +* region of VRAM was allocated as stolen memory, GTT corruption avoid. +* The stolen memory of the 2nd GPU will be free in late_init phase, +* no memory wasted.
drivers/gpu/drm/amd/amdgpu/gmc_v10_0.c static int gmc_v10_0_sw_init(void *handle) · line 782
Quoted 10 lines
drivers/gpu/drm/amd/amdgpu/gmc_v10_0.c +7
-0+*/ +if (adev->fw_vram_usage.mem_train_support && + adev->gmc.stolen_size ==0 ) { + adev->gmc.stolen_size =AMDGPU_STOLEN_VGA_DEFAULT_SIZE ; + adev->gmc.stolen_temp_reserved = true; + }else + adev->gmc.stolen_temp_reserved = false;/* Memory manager */ r =amdgpu_bo_init (adev);
_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
Quoted 10 lines · Christian König
Am 08.01.20 um 13:36 schrieb Tianci Yin:
Quoted 7 lines
From: "Tianci.Yin" <[email protected]>
[why]
In dual GPUs scenario,stolen_sizeis assigned to zero on the 2nd GPU, then the bottom region of VRAM was allocated as GTT, unfortunately a small region of bottom VRAM was encroached by UMC firmware during GDDR6 BIST training, this cause pagefault.
Quoted 3 lines
What I'm missing here is why is the stolen size zero on the 2nd GPU?
Maybe we need to read the stolen size after posting the GPU instead?
There is no stolen memory on secondary GPUs because there is no pre-OS console using that memory.
Alex
Quoted 79 lines
Regards,
Christian.Quoted 75 lines
[how]
Forcingstolen_sizeto 3MB, then the bottom region of VRAM was allocated as stolen memory, GTT corruption avoid.
The stolen memory of the 2nd GPU will be free inlate_initphase, no memory wasted.Change-Id Icd0ad7de41333282949bb1e3e676c6c307ddd081Signed-off-by Tianci.Yin <[email protected]>--- drivers/gpu/drm/amd/amdgpu/amdgpu_gmc.h | 6 ++++++ drivers/gpu/drm/amd/amdgpu/gmc_v10_0.c | 21 +++++++++++++++++++++ 2 files changed, 27 insertions(+)drivers/gpu/drm/amd/amdgpu/amdgpu_gmc.h +6
-0@@ -60,6 +60,11 @@*/ #define AMDGPU_GMC_FAULT_TIMEOUT 5000ULL +/* +* Default stolen memory size, 1024 * 768 * 4 +*/ +#define AMDGPU_STOLEN_VGA_DEFAULT_SIZE 0x300000 +struct firmware ;/* @@ -192,6 +197,7 @@ struct amdgpu_gmc {uint32_t srbm_soft_reset;bool prt_warning;uint64_t stolen_size; +bool stolen_temp_reserved;/* apertures */ u64 shared_aperture_start;u64 shared_aperture_end;drivers/gpu/drm/amd/amdgpu/gmc_v10_0.c +21
-0@@ -566,6 +566,11 @@ static int gmc_v10_0_late_init(void *handle)struct amdgpu_device *adev = (struct amdgpu_device *)handle;int r; +if (adev->gmc.stolen_temp_reserved) { +amdgpu_bo_late_init (adev); + adev->gmc.stolen_temp_reserved = false; + } + r =amdgpu_gmc_allocate_vm_inv_eng (adev);if (r)return r;@@ -756,6 +761,22 @@ static int gmc_v10_0_sw_init(void *handle)return r; adev->gmc.stolen_size =gmc_v10_0_get_vbios_fb_size (adev); +/* +* In dual GPUs scenario, stolen_size is assigned to zero on the 2nd GPU, +* then the bottom region of VRAM was allocated as GTT, unfortunately +* a small region of bottom VRAM was encroached by UMC firmware during +* GDDR6 BIST training, this cause pagefault. +* The page fault can be fixed by forcing stolen_size to 3MB, then the bottom +* region of VRAM was allocated as stolen memory, GTT corruption avoid. +* The stolen memory of the 2nd GPU will be free in late_init phase, +* no memory wasted. +*/ +if (adev->fw_vram_usage.mem_train_support && + adev->gmc.stolen_size ==0 ) { + adev->gmc.stolen_size =AMDGPU_STOLEN_VGA_DEFAULT_SIZE ; + adev->gmc.stolen_temp_reserved = true; + }else + adev->gmc.stolen_temp_reserved = false;
Quoted 7 lines
drivers/gpu/drm/amd/amdgpu/gmc_v10_0.c static int gmc_v10_0_sw_init(void *handle) · line 782
Quoted 2 lines
drivers/gpu/drm/amd/amdgpu/gmc_v10_0.c +0
-0/* Memory manager */ r =amdgpu_bo_init (adev);_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
Am 08.01.20 um 15:49 schrieb Alex Deucher:
Quoted 9 lines · Christian König
Quoted 8 lines
Am 08.01.20 um 13:36 schrieb Tianci Yin:
Quoted 7 lines
From: "Tianci.Yin" <[email protected]>
[why]
In dual GPUs scenario,stolen_sizeis assigned to zero on the 2nd GPU, then the bottom region of VRAM was allocated as GTT, unfortunately a small region of bottom VRAM was encroached by UMC firmware during GDDR6 BIST training, this cause pagefault.
Quoted 5 lines
Quoted 3 lines
What I'm missing here is why is the stolen size zero on the 2nd GPU?
Maybe we need to read the stolen size after posting the GPU instead?
There is no stolen memory on secondary GPUs because there is no pre-OS console using that memory.
Ah! Yeah that makes sense.
But in this case I would say we should change the patch like the following:
adev->gmc.stolen_size = min(adev->gmc.stolen_size, AMDGPU_STOLEN_VGA_DEFAULT_SIZE);
And in amdgpu_ttm_late_init():
/* Can't free the stolen VGA memory when it might be used for memory training again. */ if (!adev->fw_vram_usage.mem_train_support)
amdgpu_bo_free_kernel(....
Regards,
Christian.
Quoted 86 lines
Alex
Quoted 77 lines
Regards,
Christian.Quoted 74 lines
[how]
Forcingstolen_sizeto 3MB, then the bottom region of VRAM was allocated as stolen memory, GTT corruption avoid.
The stolen memory of the 2nd GPU will be free inlate_initphase, no memory wasted.Change-Id Icd0ad7de41333282949bb1e3e676c6c307ddd081Signed-off-by Tianci.Yin <[email protected]>--- drivers/gpu/drm/amd/amdgpu/amdgpu_gmc.h | 6 ++++++ drivers/gpu/drm/amd/amdgpu/gmc_v10_0.c | 21 +++++++++++++++++++++ 2 files changed, 27 insertions(+)drivers/gpu/drm/amd/amdgpu/amdgpu_gmc.h +6
-0@@ -60,6 +60,11 @@*/ #define AMDGPU_GMC_FAULT_TIMEOUT 5000ULL +/* +* Default stolen memory size, 1024 * 768 * 4 +*/ +#define AMDGPU_STOLEN_VGA_DEFAULT_SIZE 0x300000 +struct firmware ;/* @@ -192,6 +197,7 @@ struct amdgpu_gmc {uint32_t srbm_soft_reset;bool prt_warning;uint64_t stolen_size; +bool stolen_temp_reserved;/* apertures */ u64 shared_aperture_start;u64 shared_aperture_end;drivers/gpu/drm/amd/amdgpu/gmc_v10_0.c +21
-0@@ -566,6 +566,11 @@ static int gmc_v10_0_late_init(void *handle)struct amdgpu_device *adev = (struct amdgpu_device *)handle;int r; +if (adev->gmc.stolen_temp_reserved) { +amdgpu_bo_late_init (adev); + adev->gmc.stolen_temp_reserved = false; + } + r =amdgpu_gmc_allocate_vm_inv_eng (adev);if (r)return r;@@ -756,6 +761,22 @@ static int gmc_v10_0_sw_init(void *handle)return r; adev->gmc.stolen_size =gmc_v10_0_get_vbios_fb_size (adev); +/* +* In dual GPUs scenario, stolen_size is assigned to zero on the 2nd GPU, +* then the bottom region of VRAM was allocated as GTT, unfortunately +* a small region of bottom VRAM was encroached by UMC firmware during +* GDDR6 BIST training, this cause pagefault. +* The page fault can be fixed by forcing stolen_size to 3MB, then the bottom +* region of VRAM was allocated as stolen memory, GTT corruption avoid. +* The stolen memory of the 2nd GPU will be free in late_init phase, +* no memory wasted. +*/ +if (adev->fw_vram_usage.mem_train_support && + adev->gmc.stolen_size ==0 ) { + adev->gmc.stolen_size =AMDGPU_STOLEN_VGA_DEFAULT_SIZE ; + adev->gmc.stolen_temp_reserved = true; + }else + adev->gmc.stolen_temp_reserved = false;Quoted 6 lines
drivers/gpu/drm/amd/amdgpu/gmc_v10_0.c static int gmc_v10_0_sw_init(void *handle) · line 782
Quoted 2 lines
drivers/gpu/drm/amd/amdgpu/gmc_v10_0.c +0
-0/* Memory manager */ r =amdgpu_bo_init (adev);_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
Quoted 4 lines
_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
[AMD Official Use Only - Internal Distribution Only]
Thanks Alex and Christian!
Hi Christian,
On ASICs with gmc v10, I find amdgpu_bo_late_init() is not invoked, so stolen memory never get free, on other ASICs with gmc v9/v8/v7/v6, stolen memory was freed in gmc_v*_0_late_init(). I don't know why, are there some special reasons or just missed by coding?
Thanks!
Rico
________________________________
From: Christian König <[email protected]>
Sent: Wednesday, January 8, 2020 23:04
To: Alex Deucher <[email protected]>; Koenig, Christian <[email protected]>
Cc: Long, Gang <[email protected]>; Wang, Kevin(Yang) <[email protected]>; Xu, Feifei <[email protected]>; Yin, Tianci (Rico) <[email protected]>; amd-gfx list <[email protected]>; Tuikov, Luben <[email protected]>; Deucher, Alexander <[email protected]>; Yuan, Xiaojie <[email protected]>; Zhang, Hawking <[email protected]>
Subject: Re: [PATCH] drm/amdgpu: fix modprobe failure of the 2nd GPU when GDDR6 training enabled
Am 08.01.20 um 15:49 schrieb Alex Deucher:
Quoted 9 lines · Christian König
Quoted 8 lines
Am 08.01.20 um 13:36 schrieb Tianci Yin:
Quoted 7 lines
From: "Tianci.Yin" <[email protected]>
[why]
In dual GPUs scenario,stolen_sizeis assigned to zero on the 2nd GPU, then the bottom region of VRAM was allocated as GTT, unfortunately a small region of bottom VRAM was encroached by UMC firmware during GDDR6 BIST training, this cause pagefault.
Quoted 5 lines
Quoted 3 lines
What I'm missing here is why is the stolen size zero on the 2nd GPU?
Maybe we need to read the stolen size after posting the GPU instead?
There is no stolen memory on secondary GPUs because there is no pre-OS console using that memory.
Ah! Yeah that makes sense.
But in this case I would say we should change the patch like the following:
adev->gmc.stolen_size = min(adev->gmc.stolen_size, AMDGPU_STOLEN_VGA_DEFAULT_SIZE);
And in amdgpu_ttm_late_init():
/* Can't free the stolen VGA memory when it might be used for memory training again. */
if (!adev->fw_vram_usage.mem_train_support)
amdgpu_bo_free_kernel(....
Regards,
Christian.
Quoted 86 lines
Alex
Quoted 77 lines
Regards,
Christian.Quoted 74 lines
[how]
Forcingstolen_sizeto 3MB, then the bottom region of VRAM was allocated as stolen memory, GTT corruption avoid.
The stolen memory of the 2nd GPU will be free inlate_initphase, no memory wasted.Change-Id Icd0ad7de41333282949bb1e3e676c6c307ddd081Signed-off-by Tianci.Yin <[email protected]>--- drivers/gpu/drm/amd/amdgpu/amdgpu_gmc.h | 6 ++++++ drivers/gpu/drm/amd/amdgpu/gmc_v10_0.c | 21 +++++++++++++++++++++ 2 files changed, 27 insertions(+)drivers/gpu/drm/amd/amdgpu/amdgpu_gmc.h +6
-0@@ -60,6 +60,11 @@*/ #define AMDGPU_GMC_FAULT_TIMEOUT 5000ULL +/* +* Default stolen memory size, 1024 * 768 * 4 +*/ +#define AMDGPU_STOLEN_VGA_DEFAULT_SIZE 0x300000 +struct firmware ;/* @@ -192,6 +197,7 @@ struct amdgpu_gmc {uint32_t srbm_soft_reset;bool prt_warning;uint64_t stolen_size; +bool stolen_temp_reserved;/* apertures */ u64 shared_aperture_start;u64 shared_aperture_end;drivers/gpu/drm/amd/amdgpu/gmc_v10_0.c +21
-0@@ -566,6 +566,11 @@ static int gmc_v10_0_late_init(void *handle)struct amdgpu_device *adev = (struct amdgpu_device *)handle;int r; +if (adev->gmc.stolen_temp_reserved) { +amdgpu_bo_late_init (adev); + adev->gmc.stolen_temp_reserved = false; + } + r =amdgpu_gmc_allocate_vm_inv_eng (adev);if (r)return r;@@ -756,6 +761,22 @@ static int gmc_v10_0_sw_init(void *handle)return r; adev->gmc.stolen_size =gmc_v10_0_get_vbios_fb_size (adev); +/* +* In dual GPUs scenario, stolen_size is assigned to zero on the 2nd GPU, +* then the bottom region of VRAM was allocated as GTT, unfortunately +* a small region of bottom VRAM was encroached by UMC firmware during +* GDDR6 BIST training, this cause pagefault. +* The page fault can be fixed by forcing stolen_size to 3MB, then the bottom +* region of VRAM was allocated as stolen memory, GTT corruption avoid. +* The stolen memory of the 2nd GPU will be free in late_init phase, +* no memory wasted. +*/ +if (adev->fw_vram_usage.mem_train_support && + adev->gmc.stolen_size ==0 ) { + adev->gmc.stolen_size =AMDGPU_STOLEN_VGA_DEFAULT_SIZE ; + adev->gmc.stolen_temp_reserved = true; + }else + adev->gmc.stolen_temp_reserved = false;Quoted 6 lines
drivers/gpu/drm/amd/amdgpu/gmc_v10_0.c static int gmc_v10_0_sw_init(void *handle) · line 782
Quoted 2 lines
drivers/gpu/drm/amd/amdgpu/gmc_v10_0.c +0
-0/* Memory manager */ r =amdgpu_bo_init (adev);_______________________________________________
amd-gfx mailing list
[email protected]
https://nam11.safelinks.protection.outlook.com/?url=https%3A%2F%2Flists.freedesktop.org%2Fmailman%2Flistinfo%2Famd-gfx&data=02%7C01%7Ctianci.yin%40amd.com%7C1365f16aef4c418f0db308d7944c0f26%7C3dd8961fe4884e608e11a82d994e183d%7C0%7C0%7C637140926723776401&sdata=ubt7GGRaAvLzv%2F%2BUXxaTW%2FgGbKkRKWv6%2BB50fHHW3Xc%3D&reserved=0
Quoted 4 lines
_______________________________________________
amd-gfx mailing list
[email protected]
https://nam11.safelinks.protection.outlook.com/?url=https%3A%2F%2Flists.freedesktop.org%2Fmailman%2Flistinfo%2Famd-gfx&data=02%7C01%7Ctianci.yin%40amd.com%7C1365f16aef4c418f0db308d7944c0f26%7C3dd8961fe4884e608e11a82d994e183d%7C0%7C0%7C637140926723776401&sdata=ubt7GGRaAvLzv%2F%2BUXxaTW%2FgGbKkRKWv6%2BB50fHHW3Xc%3D&reserved=0
_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
Quoted 10 lines · Tianci (Rico)
[AMD Official Use Only - Internal Distribution Only]
Thanks Alex and Christian!
Hi Christian,
On ASICs with gmc v10, I find
amdgpu_bo_late_init()is not invoked, so stolen memory never get free, on other ASICs with gmc v9/v8/v7/v6, stolen memory was freed in gmc_v*_0_late_init(). I don't know why, are there some special reasons or just missed by coding?
Looks like it should be added. Possibly got lost when we merged the navi code from the topic branch.
Alex
Quoted 36 lines
Thanks!
Rico
________________________________
From: Christian König <[email protected]>
Sent: Wednesday, January 8, 2020 23:04
To: Alex Deucher <[email protected]>; Koenig, Christian <[email protected]>
Cc: Long, Gang <[email protected]>; Wang, Kevin(Yang) <[email protected]>; Xu, Feifei <[email protected]>; Yin, Tianci (Rico) <[email protected]>; amd-gfx list <[email protected]>; Tuikov, Luben <[email protected]>; Deucher, Alexander <[email protected]>; Yuan, Xiaojie <[email protected]>; Zhang, Hawking <[email protected]>
Subject: Re: [PATCH] drm/amdgpu: fix modprobe failure of the 2nd GPU when GDDR6 training enabledAm 08.01.20 um 15:49 schrieb Alex Deucher:
Quoted 9 lines · Christian König
Quoted 8 lines
Am 08.01.20 um 13:36 schrieb Tianci Yin:
Quoted 7 lines
From: "Tianci.Yin" <[email protected]>
[why]
In dual GPUs scenario,stolen_sizeis assigned to zero on the 2nd GPU, then the bottom region of VRAM was allocated as GTT, unfortunately a small region of bottom VRAM was encroached by UMC firmware during GDDR6 BIST training, this cause pagefault.Quoted 5 lines
Quoted 3 lines
What I'm missing here is why is the stolen size zero on the 2nd GPU?
Maybe we need to read the stolen size after posting the GPU instead?
There is no stolen memory on secondary GPUs because there is no pre-OS console using that memory.
Ah! Yeah that makes sense.
But in this case I would say we should change the patch like the following:
adev->gmc.stolen_size=min(adev->gmc.stolen_size, AMDGPU_STOLEN_VGA_DEFAULT_SIZE);And in
amdgpu_ttm_late_init():
Quoted 101 lines
/* Can't free the stolen VGA memory when it might be used for memory training again. */
if (!adev->fw_vram_usage.mem_train_support)amdgpu_bo_free_kernel(....Regards,
Christian.Quoted 90 lines
Alex
Quoted 77 lines
Regards,
Christian.Quoted 74 lines
[how]
Forcingstolen_sizeto 3MB, then the bottom region of VRAM was allocated as stolen memory, GTT corruption avoid.
The stolen memory of the 2nd GPU will be free inlate_initphase, no memory wasted.Change-Id Icd0ad7de41333282949bb1e3e676c6c307ddd081Signed-off-by Tianci.Yin <[email protected]>--- drivers/gpu/drm/amd/amdgpu/amdgpu_gmc.h | 6 ++++++ drivers/gpu/drm/amd/amdgpu/gmc_v10_0.c | 21 +++++++++++++++++++++ 2 files changed, 27 insertions(+)drivers/gpu/drm/amd/amdgpu/amdgpu_gmc.h +6
-0@@ -60,6 +60,11 @@*/ #define AMDGPU_GMC_FAULT_TIMEOUT 5000ULL +/* +* Default stolen memory size, 1024 * 768 * 4 +*/ +#define AMDGPU_STOLEN_VGA_DEFAULT_SIZE 0x300000 +struct firmware ;/* @@ -192,6 +197,7 @@ struct amdgpu_gmc {uint32_t srbm_soft_reset;bool prt_warning;uint64_t stolen_size; +bool stolen_temp_reserved;/* apertures */ u64 shared_aperture_start;u64 shared_aperture_end;drivers/gpu/drm/amd/amdgpu/gmc_v10_0.c +21
-0@@ -566,6 +566,11 @@ static int gmc_v10_0_late_init(void *handle)struct amdgpu_device *adev = (struct amdgpu_device *)handle;int r; +if (adev->gmc.stolen_temp_reserved) { +amdgpu_bo_late_init (adev); + adev->gmc.stolen_temp_reserved = false; + } + r =amdgpu_gmc_allocate_vm_inv_eng (adev);if (r)return r;@@ -756,6 +761,22 @@ static int gmc_v10_0_sw_init(void *handle)return r; adev->gmc.stolen_size =gmc_v10_0_get_vbios_fb_size (adev); +/* +* In dual GPUs scenario, stolen_size is assigned to zero on the 2nd GPU, +* then the bottom region of VRAM was allocated as GTT, unfortunately +* a small region of bottom VRAM was encroached by UMC firmware during +* GDDR6 BIST training, this cause pagefault. +* The page fault can be fixed by forcing stolen_size to 3MB, then the bottom +* region of VRAM was allocated as stolen memory, GTT corruption avoid. +* The stolen memory of the 2nd GPU will be free in late_init phase, +* no memory wasted. +*/ +if (adev->fw_vram_usage.mem_train_support && + adev->gmc.stolen_size ==0 ) { + adev->gmc.stolen_size =AMDGPU_STOLEN_VGA_DEFAULT_SIZE ; + adev->gmc.stolen_temp_reserved = true; + }else + adev->gmc.stolen_temp_reserved = false;Quoted 6 lines
drivers/gpu/drm/amd/amdgpu/gmc_v10_0.c static int gmc_v10_0_sw_init(void *handle) · line 782
Quoted 2 lines
drivers/gpu/drm/amd/amdgpu/gmc_v10_0.c +0
-0/* Memory manager */ r =amdgpu_bo_init (adev);_______________________________________________
amd-gfx mailing list
[email protected]
https://nam11.safelinks.protection.outlook.com/?url=https%3A%2F%2Flists.freedesktop.org%2Fmailman%2Flistinfo%2Famd-gfx&data=02%7C01%7Ctianci.yin%40amd.com%7C1365f16aef4c418f0db308d7944c0f26%7C3dd8961fe4884e608e11a82d994e183d%7C0%7C0%7C637140926723776401&sdata=ubt7GGRaAvLzv%2F%2BUXxaTW%2FgGbKkRKWv6%2BB50fHHW3Xc%3D&reserved=0_______________________________________________
amd-gfx mailing list
[email protected]
https://nam11.safelinks.protection.outlook.com/?url=https%3A%2F%2Flists.freedesktop.org%2Fmailman%2Flistinfo%2Famd-gfx&data=02%7C01%7Ctianci.yin%40amd.com%7C1365f16aef4c418f0db308d7944c0f26%7C3dd8961fe4884e608e11a82d994e183d%7C0%7C0%7C637140926723776401&sdata=ubt7GGRaAvLzv%2F%2BUXxaTW%2FgGbKkRKWv6%2BB50fHHW3Xc%3D&reserved=0
_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
[AMD Official Use Only - Internal Distribution Only]
Ok, thanks very much Alex!
________________________________
From: Alex Deucher <[email protected]>
Sent: Thursday, January 9, 2020 11:12
To: Yin, Tianci (Rico) <[email protected]>
Cc: Christian König <[email protected]>; Koenig, Christian <[email protected]>; Long, Gang <[email protected]>; Wang, Kevin(Yang) <[email protected]>; Xu, Feifei <[email protected]>; amd-gfx list <[email protected]>; Tuikov, Luben <[email protected]>; Deucher, Alexander <[email protected]>; Yuan, Xiaojie <[email protected]>; Zhang, Hawking <[email protected]>
Subject: Re: [PATCH] drm/amdgpu: fix modprobe failure of the 2nd GPU when GDDR6 training enabled
Quoted 10 lines · Tianci (Rico)
[AMD Official Use Only - Internal Distribution Only]
Thanks Alex and Christian!
Hi Christian,
On ASICs with gmc v10, I find
amdgpu_bo_late_init()is not invoked, so stolen memory never get free, on other ASICs with gmc v9/v8/v7/v6, stolen memory was freed in gmc_v*_0_late_init(). I don't know why, are there some special reasons or just missed by coding?
Looks like it should be added. Possibly got lost when we merged the navi code from the topic branch.
Alex
Quoted 36 lines
Thanks!
Rico
________________________________
From: Christian König <[email protected]>
Sent: Wednesday, January 8, 2020 23:04
To: Alex Deucher <[email protected]>; Koenig, Christian <[email protected]>
Cc: Long, Gang <[email protected]>; Wang, Kevin(Yang) <[email protected]>; Xu, Feifei <[email protected]>; Yin, Tianci (Rico) <[email protected]>; amd-gfx list <[email protected]>; Tuikov, Luben <[email protected]>; Deucher, Alexander <[email protected]>; Yuan, Xiaojie <[email protected]>; Zhang, Hawking <[email protected]>
Subject: Re: [PATCH] drm/amdgpu: fix modprobe failure of the 2nd GPU when GDDR6 training enabledAm 08.01.20 um 15:49 schrieb Alex Deucher:
Quoted 9 lines · Christian König
Quoted 8 lines
Am 08.01.20 um 13:36 schrieb Tianci Yin:
Quoted 7 lines
From: "Tianci.Yin" <[email protected]>
[why]
In dual GPUs scenario,stolen_sizeis assigned to zero on the 2nd GPU, then the bottom region of VRAM was allocated as GTT, unfortunately a small region of bottom VRAM was encroached by UMC firmware during GDDR6 BIST training, this cause pagefault.Quoted 5 lines
Quoted 3 lines
What I'm missing here is why is the stolen size zero on the 2nd GPU?
Maybe we need to read the stolen size after posting the GPU instead?
There is no stolen memory on secondary GPUs because there is no pre-OS console using that memory.
Ah! Yeah that makes sense.
But in this case I would say we should change the patch like the following:
adev->gmc.stolen_size=min(adev->gmc.stolen_size, AMDGPU_STOLEN_VGA_DEFAULT_SIZE);And in
amdgpu_ttm_late_init():
Quoted 101 lines
/* Can't free the stolen VGA memory when it might be used for memory training again. */
if (!adev->fw_vram_usage.mem_train_support)amdgpu_bo_free_kernel(....Regards,
Christian.Quoted 90 lines
Alex
Quoted 77 lines
Regards,
Christian.Quoted 74 lines
[how]
Forcingstolen_sizeto 3MB, then the bottom region of VRAM was allocated as stolen memory, GTT corruption avoid.
The stolen memory of the 2nd GPU will be free inlate_initphase, no memory wasted.Change-Id Icd0ad7de41333282949bb1e3e676c6c307ddd081Signed-off-by Tianci.Yin <[email protected]>--- drivers/gpu/drm/amd/amdgpu/amdgpu_gmc.h | 6 ++++++ drivers/gpu/drm/amd/amdgpu/gmc_v10_0.c | 21 +++++++++++++++++++++ 2 files changed, 27 insertions(+)drivers/gpu/drm/amd/amdgpu/amdgpu_gmc.h +6
-0@@ -60,6 +60,11 @@*/ #define AMDGPU_GMC_FAULT_TIMEOUT 5000ULL +/* +* Default stolen memory size, 1024 * 768 * 4 +*/ +#define AMDGPU_STOLEN_VGA_DEFAULT_SIZE 0x300000 +struct firmware ;/* @@ -192,6 +197,7 @@ struct amdgpu_gmc {uint32_t srbm_soft_reset;bool prt_warning;uint64_t stolen_size; +bool stolen_temp_reserved;/* apertures */ u64 shared_aperture_start;u64 shared_aperture_end;drivers/gpu/drm/amd/amdgpu/gmc_v10_0.c +21
-0@@ -566,6 +566,11 @@ static int gmc_v10_0_late_init(void *handle)struct amdgpu_device *adev = (struct amdgpu_device *)handle;int r; +if (adev->gmc.stolen_temp_reserved) { +amdgpu_bo_late_init (adev); + adev->gmc.stolen_temp_reserved = false; + } + r =amdgpu_gmc_allocate_vm_inv_eng (adev);if (r)return r;@@ -756,6 +761,22 @@ static int gmc_v10_0_sw_init(void *handle)return r; adev->gmc.stolen_size =gmc_v10_0_get_vbios_fb_size (adev); +/* +* In dual GPUs scenario, stolen_size is assigned to zero on the 2nd GPU, +* then the bottom region of VRAM was allocated as GTT, unfortunately +* a small region of bottom VRAM was encroached by UMC firmware during +* GDDR6 BIST training, this cause pagefault. +* The page fault can be fixed by forcing stolen_size to 3MB, then the bottom +* region of VRAM was allocated as stolen memory, GTT corruption avoid. +* The stolen memory of the 2nd GPU will be free in late_init phase, +* no memory wasted. +*/ +if (adev->fw_vram_usage.mem_train_support && + adev->gmc.stolen_size ==0 ) { + adev->gmc.stolen_size =AMDGPU_STOLEN_VGA_DEFAULT_SIZE ; + adev->gmc.stolen_temp_reserved = true; + }else + adev->gmc.stolen_temp_reserved = false;Quoted 6 lines
drivers/gpu/drm/amd/amdgpu/gmc_v10_0.c static int gmc_v10_0_sw_init(void *handle) · line 782
Quoted 2 lines
drivers/gpu/drm/amd/amdgpu/gmc_v10_0.c +0
-0/* Memory manager */ r =amdgpu_bo_init (adev);_______________________________________________
amd-gfx mailing list
[email protected]
https://nam11.safelinks.protection.outlook.com/?url=https%3A%2F%2Flists.freedesktop.org%2Fmailman%2Flistinfo%2Famd-gfx&data=02%7C01%7CTianci.Yin%40amd.com%7Cb9b1622ed60e4ab36c6408d794b1d75e%7C3dd8961fe4884e608e11a82d994e183d%7C0%7C0%7C637141363862418597&sdata=YT8zKlbLX0XdzqcLrZQaV6sKFWXS5nQTNMAMT9BMK70%3D&reserved=0_______________________________________________
amd-gfx mailing list
[email protected]
https://nam11.safelinks.protection.outlook.com/?url=https%3A%2F%2Flists.freedesktop.org%2Fmailman%2Flistinfo%2Famd-gfx&data=02%7C01%7CTianci.Yin%40amd.com%7Cb9b1622ed60e4ab36c6408d794b1d75e%7C3dd8961fe4884e608e11a82d994e183d%7C0%7C0%7C637141363862428589&sdata=LLVRzFBxFKqTltpvsK%2F2l9CwnlUFzFKmDoPPHdO5e1I%3D&reserved=0
_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
Hi Rico,
maybe it is a good idea to look into the git history and/or google the mailing list history a bit more.
I do briefly remember that we disabled freeing up the stolen VGA memory on some hardware generations because somebody was accessing that memory even after VGA was turned off.
At that time we couldn't figure out what was going wrong, but it is perfectly possible that those memory training fixes your are working on here are related to that issue.
On the other hand if you can't find anything immediately feel free to go with Alex suggestion, if something goes wrong we can still revert the change.
Regards,
Christian.
Am 09.01.20 um 04:15 schrieb Yin, Tianci (Rico):
Quoted 176 lines
[AMD Official Use Only - Internal Distribution Only]
Ok, thanks very much Alex!
------------------------------------------------------------------------
*From:* Alex Deucher <[email protected]>
*Sent:* Thursday, January 9, 2020 11:12
*To:* Yin, Tianci (Rico) <[email protected]>
*Cc:* Christian König <[email protected]>; Koenig, Christian <[email protected]>; Long, Gang <[email protected]>; Wang, Kevin(Yang) <[email protected]>; Xu, Feifei <[email protected]>; amd-gfx list <[email protected]>; Tuikov, Luben <[email protected]>; Deucher, Alexander <[email protected]>; Yuan, Xiaojie <[email protected]>; Zhang, Hawking <[email protected]> *Subject:* Re: [PATCH] drm/amdgpu: fix modprobe failure of the 2nd GPU when GDDR6 training enabledQuoted 9 lines · Tianci (Rico)
[AMD Official Use Only - Internal Distribution Only]
Thanks Alex and Christian!
Hi Christian,
On ASICs with gmc v10, I find
amdgpu_bo_late_init()is not invoked,so stolen memory never get free, on other ASICs with gmc v9/v8/v7/v6, stolen memory was freed in gmc_v*_0_late_init(). I don't know why, are there some special reasons or just missed by coding?
Quoted 1 line
Looks like it should be added. Possibly got lost when we merged the navi code from the topic branch.
Alex
Quoted 8 lines
Thanks!
Rico
________________________________
From: Christian König <[email protected]>
Sent: Wednesday, January 8, 2020 23:04
To: Alex Deucher <[email protected]>; Koenig, ChristianQuoted 1 line
Cc Long, Gang <[email protected]>; Wang, Kevin(Yang)<[email protected]>; Xu, Feifei <[email protected]>; Yin, Tianci (Rico) <[email protected]>; amd-gfx list <[email protected]>; Tuikov, Luben <[email protected]>; Deucher, Alexander <[email protected]>; Yuan, Xiaojie <[email protected]>; Zhang, Hawking <[email protected]>
Quoted 1 line
Subject: Re: [PATCH] drm/amdgpu: fix modprobe failure of the 2nd GPU
when GDDR6 training enabled
Quoted 3 lines
Am 08.01.20 um 15:49 schrieb Alex Deucher:
Quoted 1 line
On Wed, Jan 8, 2020 at 7:52 AM Christian König
Quoted 5 lines · <[email protected]> wrote:
Quoted 5 lines
Quoted 5 lines
Am 08.01.20 um 13:36 schrieb Tianci Yin:
Quoted 4 lines
From: "Tianci.Yin" <[email protected]>
[why]
In dual GPUs scenario,stolen_sizeis assigned to zero on the2nd GPU,
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
Quoted 3 lines
then the bottom region of VRAM was allocated as GTT, unfortunately a small region of bottom VRAM was encroached by UMC firmware during GDDR6 BIST training, this cause pagefault.
What I'm missing here is why is the stolen size zero on the 2nd GPU?
Quoted 7 lines
Quoted 3 lines
Quoted 1 line
Maybe we need to read the stolen size after posting the GPU instead?
There is no stolen memory on secondary GPUs because there is no pre-OS console using that memory.
Ah! Yeah that makes sense.
But in this case I would say we should change the patch like the
following:
Quoted 28 lines
adev->gmc.stolen_size=min(adev->gmc.stolen_size, AMDGPU_STOLEN_VGA_DEFAULT_SIZE);And in
amdgpu_ttm_late_init():/* Can't free the stolen VGA memory when it might be used for memory training again. */
if (!adev->fw_vram_usage.mem_train_support) amdgpu_bo_free_kernel(....Regards,
Christian.Quoted 12 lines
Alex
Quoted 9 lines
Regards,
Christian.Quoted 6 lines
[how]
Forcingstolen_sizeto 3MB, then the bottom region of VRAM was allocated as stolen memory, GTT corruption avoid.
The stolen memory of the 2nd GPU will be free inlate_initphase, no memory wasted.Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Review
Quoted 8 lines
Change-Id Icd0ad7de41333282949bb1e3e676c6c307ddd081Signed-off-by Tianci.Yin <[email protected]>---
drivers/gpu/drm/amd/amdgpu/amdgpu_gmc.h| 6 ++++++ drivers/gpu/drm/amd/amdgpu/gmc_v10_0.c | 21 +++++++++++++++++++++2 files changed, 27 insertions(+)(quoted diff) +0
-0
b/drivers/gpu/drm/amd/amdgpu/amdgpu_gmc.hQuoted 14 lines
Quoted 14 lines
Quoted 14 lines
Quoted 14 lines
index
c91dd602d5f1..440b793316df100644drivers/gpu/drm/amd/amdgpu/amdgpu_gmc.h +5
-0@@ -60,6 +60,11 @@*/ #define AMDGPU_GMC_FAULT_TIMEOUT 5000ULL +/* +* Default stolen memory size, 1024 * 768 * 4 +*/ +#define AMDGPU_STOLEN_VGA_DEFAULT_SIZE 0x300000 + struct firmware;Quoted 10 lines
Quoted 10 lines
Quoted 10 lines
Review
Quoted 10 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_gmc.h +1
-0/*@@ -192,6 +197,7 @@ struct amdgpu_gmc { uint32_t srbm_soft_reset; bool prt_warning; uint64_t stolen_size; + bool stolen_temp_reserved; /* apertures */ u64 shared_aperture_start; u64 shared_aperture_end;(quoted diff) +0
-0
b/drivers/gpu/drm/amd/amdgpu/gmc_v10_0.cQuoted 18 lines
Quoted 18 lines
Quoted 18 lines
Quoted 18 lines
index
7dc8c068c62a..0c96b67d6ca7100644drivers/gpu/drm/amd/amdgpu/gmc_v10_0.c +5
-0@@ -566,6 +566,11 @@ static int gmc_v10_0_late_init(void *handle) struct amdgpu_device *adev = (struct amdgpu_device *)handle; int r; + if (adev->gmc.stolen_temp_reserved) { +amdgpu_bo_late_init (adev); + adev->gmc.stolen_temp_reserved = false; + } + r = amdgpu_gmc_allocate_vm_inv_eng(adev); if (r) return r;@@ -756,6 +761,22 @@ static int gmc_v10_0_sw_init(void *handle) return r;Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
drivers/gpu/drm/amd/amdgpu/gmc_v10_0.c static int gmc_v10_0_sw_init(void *handle) · line 765
Quoted 3 lines
drivers/gpu/drm/amd/amdgpu/gmc_v10_0.c +2
-0adev->gmc.stolen_size = gmc_v10_0_get_vbios_fb_size(adev); + /* +* In dual GPUs scenario, stolen_size is assigned to zero on the 2nd GPU,
Quoted 1 line
Quoted 1 line
Quoted 1 line
drivers/gpu/drm/amd/amdgpu/gmc_v10_0.c static int gmc_v10_0_sw_init(void *handle) · line 766
Quoted 1 line
drivers/gpu/drm/amd/amdgpu/gmc_v10_0.c +1
-0+ * then the bottom region of VRAM was allocated as GTT,unfortunately
Quoted 1 line
Quoted 1 line
Quoted 1 line
drivers/gpu/drm/amd/amdgpu/gmc_v10_0.c static int gmc_v10_0_sw_init(void *handle) · line 767
Quoted 1 line
drivers/gpu/drm/amd/amdgpu/gmc_v10_0.c +1
-0+ * a small region of bottom VRAM was encroached by UMCfirmware during
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
drivers/gpu/drm/amd/amdgpu/gmc_v10_0.c static int gmc_v10_0_sw_init(void *handle) · line 769
Quoted 2 lines
drivers/gpu/drm/amd/amdgpu/gmc_v10_0.c +2
-0+ * GDDR6 BIST training, this cause pagefault. + * The page fault can be fixed by forcing stolen_size to3MB, then the bottom
Quoted 1 line
Quoted 1 line
Quoted 1 line
drivers/gpu/drm/amd/amdgpu/gmc_v10_0.c static int gmc_v10_0_sw_init(void *handle) · line 770
Quoted 1 line
drivers/gpu/drm/amd/amdgpu/gmc_v10_0.c +1
-0+ * region of VRAM was allocated as stolen memory, GTTcorruption avoid.
Quoted 1 line
Quoted 1 line
Quoted 1 line
drivers/gpu/drm/amd/amdgpu/gmc_v10_0.c static int gmc_v10_0_sw_init(void *handle) · line 771
Quoted 1 line
drivers/gpu/drm/amd/amdgpu/gmc_v10_0.c +1
-0+ * The stolen memory of the 2nd GPU will be free in
late_initphase,Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
drivers/gpu/drm/amd/amdgpu/gmc_v10_0.c static int gmc_v10_0_sw_init(void *handle) · line 776
Quoted 5 lines
drivers/gpu/drm/amd/amdgpu/gmc_v10_0.c +5
-0+* no memory wasted. +*/ + if (adev->fw_vram_usage.mem_train_support && + adev->gmc.stolen_size == 0) { + adev->gmc.stolen_size =
AMDGPU_STOLEN_VGA_DEFAULT_SIZE;Quoted 10 lines
Quoted 10 lines
Quoted 10 lines
drivers/gpu/drm/amd/amdgpu/gmc_v10_0.c static int gmc_v10_0_sw_init(void *handle) · line 782
Quoted 6 lines
drivers/gpu/drm/amd/amdgpu/gmc_v10_0.c +3
-0+ adev->gmc.stolen_temp_reserved = true; + } else + adev->gmc.stolen_temp_reserved = false; /* Memory manager */ r = amdgpu_bo_init(adev);_______________________________________________
amd-gfx mailing list
[email protected]
Quoted 7 lines
Quoted 4 lines
Quoted 4 lines
_______________________________________________
amd-gfx mailing list
[email protected]Quoted 1 line
_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
[AMD Official Use Only - Internal Distribution Only]
Hi Christian,
Thanks very much for your suggestions, I checked the original version of gmc_v10_0.c on branch origin/ruihuang/amd-temp-navi10-part1, amdgpu_bo_late_init() is not invoked by gmc_v10_0_late_init(), so I think it was missed from the beginning time.
Yes, it seems we all have ever met the VRAM overwritten issue, but it's not easy to figure out who did it. Are there some source that we can get this kind of information? If there is a place gathered this kind of information, it should save us much debug time.
Thanks!
Rico
________________________________
From: Christian König <[email protected]>
Sent: Thursday, January 9, 2020 18:29
To: Yin, Tianci (Rico) <[email protected]>; Alex Deucher <[email protected]>
Cc: Koenig, Christian <[email protected]>; Long, Gang <[email protected]>; Wang, Kevin(Yang) <[email protected]>; Xu, Feifei <[email protected]>; amd-gfx list <[email protected]>; Tuikov, Luben <[email protected]>; Deucher, Alexander <[email protected]>; Yuan, Xiaojie <[email protected]>; Zhang, Hawking <[email protected]>
Subject: Re: [PATCH] drm/amdgpu: fix modprobe failure of the 2nd GPU when GDDR6 training enabled
Hi Rico,
maybe it is a good idea to look into the git history and/or google the mailing list history a bit more.
I do briefly remember that we disabled freeing up the stolen VGA memory on some hardware generations because somebody was accessing that memory even after VGA was turned off.
At that time we couldn't figure out what was going wrong, but it is perfectly possible that those memory training fixes your are working on here are related to that issue.
On the other hand if you can't find anything immediately feel free to go with Alex suggestion, if something goes wrong we can still revert the change.
Regards,
Christian.
Am 09.01.20 um 04:15 schrieb Yin, Tianci (Rico):
[AMD Official Use Only - Internal Distribution Only]
Ok, thanks very much Alex!
________________________________
From: Alex Deucher <[email protected]><mailto:[email protected]>
Sent: Thursday, January 9, 2020 11:12
To: Yin, Tianci (Rico) <[email protected]><mailto:[email protected]>
Cc: Christian König <[email protected]><mailto:[email protected]>; Koenig, Christian <[email protected]><mailto:[email protected]>; Long, Gang <[email protected]><mailto:[email protected]>; Wang, Kevin(Yang) <[email protected]><mailto:[email protected]>; Xu, Feifei <[email protected]><mailto:[email protected]>; amd-gfx list <[email protected]><mailto:[email protected]>; Tuikov, Luben <[email protected]><mailto:[email protected]>; Deucher, Alexander <[email protected]><mailto:[email protected]>; Yuan, Xiaojie <[email protected]><mailto:[email protected]>; Zhang, Hawking <[email protected]><mailto:[email protected]>
Subject: Re: [PATCH] drm/amdgpu: fix modprobe failure of the 2nd GPU when GDDR6 training enabled
Quoted 10 lines · On Wed, Jan 8, 2020 at 10:07 PM Yin, Tianci (Rico)…
[AMD Official Use Only - Internal Distribution Only]
Thanks Alex and Christian!
Hi Christian,
On ASICs with gmc v10, I find
amdgpu_bo_late_init()is not invoked, so stolen memory never get free, on other ASICs with gmc v9/v8/v7/v6, stolen memory was freed in gmc_v*_0_late_init(). I don't know why, are there some special reasons or just missed by coding?
Looks like it should be added. Possibly got lost when we merged the navi code from the topic branch.
Alex
Quoted 36 lines
Thanks!
Rico
________________________________
From: Christian König <[email protected]><mailto:[email protected]>
Sent: Wednesday, January 8, 2020 23:04
To: Alex Deucher <[email protected]><mailto:[email protected]>; Koenig, Christian <[email protected]><mailto:[email protected]>
Cc: Long, Gang <[email protected]><mailto:[email protected]>; Wang, Kevin(Yang) <[email protected]><mailto:[email protected]>; Xu, Feifei <[email protected]><mailto:[email protected]>; Yin, Tianci (Rico) <[email protected]><mailto:[email protected]>; amd-gfx list <[email protected]><mailto:[email protected]>; Tuikov, Luben <[email protected]><mailto:[email protected]>; Deucher, Alexander <[email protected]><mailto:[email protected]>; Yuan, Xiaojie <[email protected]><mailto:[email protected]>; Zhang, Hawking <[email protected]><mailto:[email protected]>
Subject: Re: [PATCH] drm/amdgpu: fix modprobe failure of the 2nd GPU when GDDR6 training enabledAm 08.01.20 um 15:49 schrieb Alex Deucher:
Quoted 9 lines · On Wed, Jan 8, 2020 at 7:52 AM Christian König…
Quoted 8 lines
Am 08.01.20 um 13:36 schrieb Tianci Yin:
Quoted 7 lines
From: "Tianci.Yin" <[email protected]><mailto:[email protected]>
[why]
In dual GPUs scenario,stolen_sizeis assigned to zero on the 2nd GPU, then the bottom region of VRAM was allocated as GTT, unfortunately a small region of bottom VRAM was encroached by UMC firmware during GDDR6 BIST training, this cause pagefault.Quoted 5 lines
Quoted 3 lines
What I'm missing here is why is the stolen size zero on the 2nd GPU?
Maybe we need to read the stolen size after posting the GPU instead?
There is no stolen memory on secondary GPUs because there is no pre-OS console using that memory.
Ah! Yeah that makes sense.
But in this case I would say we should change the patch like the following:
adev->gmc.stolen_size=min(adev->gmc.stolen_size, AMDGPU_STOLEN_VGA_DEFAULT_SIZE);And in
amdgpu_ttm_late_init():
Quoted 101 lines
/* Can't free the stolen VGA memory when it might be used for memory training again. */
if (!adev->fw_vram_usage.mem_train_support)amdgpu_bo_free_kernel(....Regards,
Christian.Quoted 90 lines
Alex
Quoted 77 lines
Regards,
Christian.Quoted 74 lines
[how]
Forcingstolen_sizeto 3MB, then the bottom region of VRAM was allocated as stolen memory, GTT corruption avoid.
The stolen memory of the 2nd GPU will be free inlate_initphase, no memory wasted.Change-Id Icd0ad7de41333282949bb1e3e676c6c307ddd081Signed-off-by Tianci.Yin <[email protected]><mailto:[email protected]>--- drivers/gpu/drm/amd/amdgpu/amdgpu_gmc.h | 6 ++++++ drivers/gpu/drm/amd/amdgpu/gmc_v10_0.c | 21 +++++++++++++++++++++ 2 files changed, 27 insertions(+)drivers/gpu/drm/amd/amdgpu/amdgpu_gmc.h +6
-0@@ -60,6 +60,11 @@*/ #define AMDGPU_GMC_FAULT_TIMEOUT 5000ULL +/* +* Default stolen memory size, 1024 * 768 * 4 +*/ +#define AMDGPU_STOLEN_VGA_DEFAULT_SIZE 0x300000 +struct firmware ;/* @@ -192,6 +197,7 @@ struct amdgpu_gmc {uint32_t srbm_soft_reset;bool prt_warning;uint64_t stolen_size; +bool stolen_temp_reserved;/* apertures */ u64 shared_aperture_start;u64 shared_aperture_end;drivers/gpu/drm/amd/amdgpu/gmc_v10_0.c +21
-0@@ -566,6 +566,11 @@ static int gmc_v10_0_late_init(void *handle)struct amdgpu_device *adev = (struct amdgpu_device *)handle;int r; +if (adev->gmc.stolen_temp_reserved) { +amdgpu_bo_late_init (adev); + adev->gmc.stolen_temp_reserved = false; + } + r =amdgpu_gmc_allocate_vm_inv_eng (adev);if (r)return r;@@ -756,6 +761,22 @@ static int gmc_v10_0_sw_init(void *handle)return r; adev->gmc.stolen_size =gmc_v10_0_get_vbios_fb_size (adev); +/* +* In dual GPUs scenario, stolen_size is assigned to zero on the 2nd GPU, +* then the bottom region of VRAM was allocated as GTT, unfortunately +* a small region of bottom VRAM was encroached by UMC firmware during +* GDDR6 BIST training, this cause pagefault. +* The page fault can be fixed by forcing stolen_size to 3MB, then the bottom +* region of VRAM was allocated as stolen memory, GTT corruption avoid. +* The stolen memory of the 2nd GPU will be free in late_init phase, +* no memory wasted. +*/ +if (adev->fw_vram_usage.mem_train_support && + adev->gmc.stolen_size ==0 ) { + adev->gmc.stolen_size =AMDGPU_STOLEN_VGA_DEFAULT_SIZE ; + adev->gmc.stolen_temp_reserved = true; + }else + adev->gmc.stolen_temp_reserved = false;Quoted 6 lines
drivers/gpu/drm/amd/amdgpu/gmc_v10_0.c static int gmc_v10_0_sw_init(void *handle) · line 782
Quoted 2 lines
drivers/gpu/drm/amd/amdgpu/gmc_v10_0.c +0
-0/* Memory manager */ r =amdgpu_bo_init (adev);_______________________________________________
amd-gfx mailing list [email protected]<mailto:[email protected]>
https://nam11.safelinks.protection.outlook.com/?url=https%3A%2F%2Flists.freedesktop.org%2Fmailman%2Flistinfo%2Famd-gfx&data=02%7C01%7CTianci.Yin%40amd.com%7Cb9b1622ed60e4ab36c6408d794b1d75e%7C3dd8961fe4884e608e11a82d994e183d%7C0%7C0%7C637141363862418597&sdata=YT8zKlbLX0XdzqcLrZQaV6sKFWXS5nQTNMAMT9BMK70%3D&reserved=0<https://nam11.safelinks.protection.outlook.com/?url=https%3A%2F%2Flists.freedesktop.org%2Fmailman%2Flistinfo%2Famd-gfx&data=02%7C01%7CTianci.Yin%40amd.com%7Ca21d3576dde64ae42f0908d794eede11%7C3dd8961fe4884e608e11a82d994e183d%7C0%7C0%7C637141625988841768&sdata=j%2F7xYrXd%2F%2BUIke9EhCdHxknY8TmgspnCyxcz6cTbpYg%3D&reserved=0>_______________________________________________
amd-gfx mailing list [email protected]<mailto:[email protected]>
https://nam11.safelinks.protection.outlook.com/?url=https%3A%2F%2Flists.freedesktop.org%2Fmailman%2Flistinfo%2Famd-gfx&data=02%7C01%7CTianci.Yin%40amd.com%7Cb9b1622ed60e4ab36c6408d794b1d75e%7C3dd8961fe4884e608e11a82d994e183d%7C0%7C0%7C637141363862428589&sdata=LLVRzFBxFKqTltpvsK%2F2l9CwnlUFzFKmDoPPHdO5e1I%3D&reserved=0<https://nam11.safelinks.protection.outlook.com/?url=https%3A%2F%2Flists.freedesktop.org%2Fmailman%2Flistinfo%2Famd-gfx&data=02%7C01%7CTianci.Yin%40amd.com%7Ca21d3576dde64ae42f0908d794eede11%7C3dd8961fe4884e608e11a82d994e183d%7C0%7C0%7C637141625988851763&sdata=0OGgqQKu%2F9G0lJGXgDy25P%2F9GEU%2FlvdeFd5gRtLhPyQ%3D&reserved=0>
_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx