Skip to contentSkip to conversation

drm/amdgpu: don't clean the framebuffer for VF

PATCH In review Pixel Ding 3 participants 8 messages Feb 6, 2017 – Feb 7, 2017 5 messages not in the archive

Subsystems (2)
lore
Share & tools
lore

Pixel Ding

author
#0 lore raw

PATCH 1/2 drm/amdgpu: don't clean the framebuffer for VF

The SRIOV host driver cleans framebuffer for each VF, guest driver needn't this action which costs much time on some virtualization platform, otherwise it might get timeout to initialize.

---
 drivers/gpu/drm/amd/amdgpu/amdgpu_fb.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_fb.c +3 -1
index 1e735c4..f1eb4f5 100644
@@ -242,7 +242,9 @@ static int amdgpufb_create(struct drm_fb_helper *helper,
 	/* setup helper */
 	rfbdev->helper.fb = fb;
 
-	memset_io(abo->kptr, 0x0, amdgpu_bo_size(abo));
+	if (!amdgpu_sriov_vf(adev)) {
+		memset_io(abo->kptr, 0x0, amdgpu_bo_size(abo));
+	}
 
 	strcpy(info->fix.id, "amdgpudrmfb");
 
Signature · 6 lines
2.7.4

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

A message that is not in the archive (sent off-list or not yet received): 1486362299-3961-1-git-send-email-Pixel.Ding-5C7GfCeVMHo@public.gmane.org

Acked-by Xiangliang.Yu
#2 lore raw

Thanks!
Xiangliang Yu

Quoted 37 lines

-----Original Message-----
From: amd-gfx [mailto:[email protected]] On Behalf Of Pixel Ding
Sent: Monday, February 06, 2017 2:25 PM
To: [email protected]
Cc: Ding, Pixel <[email protected]>; [email protected]
Subject: [PATCH 1/2] drm/amdgpu: don't clean the framebuffer for VF

The SRIOV host driver cleans framebuffer for each VF, guest driver needn't this action which costs much time on some virtualization platform, otherwise it might get timeout to initialize.

---
 drivers/gpu/drm/amd/amdgpu/amdgpu_fb.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_fb.c +3 -2
index 1e735c4..f1eb4f5 100644
@@ -242,7 +242,9 @@ static int amdgpufb_create(struct drm_fb_helper
 *helper,
 	/* setup helper */
 	rfbdev->helper.fb = fb;
 
-	memset_io(abo->kptr, 0x0, amdgpu_bo_size(abo));
+	if (!amdgpu_sriov_vf(adev)) {
+		memset_io(abo->kptr, 0x0, amdgpu_bo_size(abo));
+	}
 
 	strcpy(info->fix.id, "amdgpudrmfb");
 
--

2.7.4

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

#3 lore raw
In reply to a message not in the archive

Am 06.02.2017 um 07:24 schrieb Pixel Ding:

Quoted 14 lines

The SRIOV host driver cleans framebuffer for each VF, guest driver needn't this action which costs much time on some virtualization platform, otherwise it might get timeout to initialize.

---
  drivers/gpu/drm/amd/amdgpu/amdgpu_fb.c | 4 +++-
  1 file changed, 3 insertions(+), 1 deletion(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_fb.c +0 -0
index 1e735c4..f1eb4f5 100644

drivers/gpu/drm/amd/amdgpu/amdgpu_fb.c static int amdgpufb_create(struct drm_fb_helper *helper, · line 247

Quoted 7 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_fb.c +3 -1
@@ -242,7 +242,9 @@ static int amdgpufb_create(struct drm_fb_helper *helper,
  	/* setup helper */
  	rfbdev->helper.fb = fb;
 
-	memset_io(abo->kptr, 0x0, amdgpu_bo_size(abo));
+	if (!amdgpu_sriov_vf(adev)) {
+		memset_io(abo->kptr, 0x0, amdgpu_bo_size(abo));
+	}

Nit pick only, but coding style says to not use "{" "}" in an if without else and only a single line of code.

Additional to that I'm not sure if that's a good idea. The memory allocated here might be already be used and so we need to clear it no matter where it came from.

It's probably easier to just set the AMDGPU_GEM_CREATE_VRAM_CLEARED in the call to amdgpu_gem_object_create(). This makes the GPU clear the memory before the first CPU access to it.

Regards,
Christian.

drivers/gpu/drm/amd/amdgpu/amdgpu_fb.c static int amdgpufb_create(struct drm_fb_helper *helper, · line 250

Quoted 3 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_fb.c +0 -0
  	strcpy(info->fix.id, "amdgpudrmfb");
 

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

A message that is not in the archive (sent off-list or not yet received): 9fb90cdc-60e4-babf-e721-10434ffda956-5C7GfCeVMHo@public.gmane.org

#5 lore raw

Hi Christian,

The underlying host driver clears VF’s framebuffer when guest driver shake hands with it, that is done before guest driver init. I think it’s unnecessary to clear FB again even with GPU for VF.

—
Sincerely Yours,
Pixel

Quoted 30 lines · Christian

Am 06.02.2017 um 07:24 schrieb Pixel Ding:

Quoted 14 lines

The SRIOV host driver cleans framebuffer for each VF, guest driver needn't this action which costs much time on some virtualization platform, otherwise it might get timeout to initialize.

---
  drivers/gpu/drm/amd/amdgpu/amdgpu_fb.c | 4 +++-
  1 file changed, 3 insertions(+), 1 deletion(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_fb.c +0 -0
index 1e735c4..f1eb4f5 100644

drivers/gpu/drm/amd/amdgpu/amdgpu_fb.c static int amdgpufb_create(struct drm_fb_helper *helper, · line 247

Quoted 7 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_fb.c +3 -1
@@ -242,7 +242,9 @@ static int amdgpufb_create(struct drm_fb_helper *helper,
  	/* setup helper */
  	rfbdev->helper.fb = fb;
 
-	memset_io(abo->kptr, 0x0, amdgpu_bo_size(abo));
+	if (!amdgpu_sriov_vf(adev)) {
+		memset_io(abo->kptr, 0x0, amdgpu_bo_size(abo));
+	}

Nit pick only, but coding style says to not use "{" "}" in an if without else and only a single line of code.

Additional to that I'm not sure if that's a good idea. The memory allocated here might be already be used and so we need to clear it no matter where it came from.

Quoted 12 lines

It's probably easier to just set the AMDGPU_GEM_CREATE_VRAM_CLEARED in the call to amdgpu_gem_object_create(). This makes the GPU clear the memory before the first CPU access to it.

Regards,
Christian.

Quoted 3 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_fb.c +0 -0
  	strcpy(info->fix.id, "amdgpudrmfb");
 

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

A message that is not in the archive (sent off-list or not yet received): 33AD6DBD-DC84-40FC-9CDF-02A18620F06C-5C7GfCeVMHo@public.gmane.org

#7 lore raw

Hi Pixel,

you don't seem to understand the reason for the clear here.

It is completely irrelevant that the host is clearing the memory for the guest, the problem is that the guest reuse the memory it got assigned from the host multiple times.

IIRC we added this because you could see leftovers of the slash screen in the text console when the resolution wasn't a multiple of the character height.

Regards,
Christian.

Am 06.02.2017 um 10:09 schrieb Ding, Pixel:

Quoted 12 lines

Hi Christian,

The underlying host driver clears VF’s framebuffer when guest driver shake hands with it, that is done before guest driver init. I think it’s unnecessary to clear FB again even with GPU for VF.

—
Sincerely Yours,
Pixel

Quoted 42 lines
Quoted 40 lines · Christian

Am 06.02.2017 um 07:24 schrieb Pixel Ding:

Quoted 14 lines

The SRIOV host driver cleans framebuffer for each VF, guest driver needn't this action which costs much time on some virtualization platform, otherwise it might get timeout to initialize.

---
   drivers/gpu/drm/amd/amdgpu/amdgpu_fb.c | 4 +++-
   1 file changed, 3 insertions(+), 1 deletion(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_fb.c +0 -0
index 1e735c4..f1eb4f5 100644

drivers/gpu/drm/amd/amdgpu/amdgpu_fb.c static int amdgpufb_create(struct drm_fb_helper *helper, · line 247

Quoted 7 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_fb.c +3 -1
@@ -242,7 +242,9 @@ static int amdgpufb_create(struct drm_fb_helper *helper,
   	/* setup helper */
   	rfbdev->helper.fb = fb;
 
-	memset_io(abo->kptr, 0x0, amdgpu_bo_size(abo));
+	if (!amdgpu_sriov_vf(adev)) {
+		memset_io(abo->kptr, 0x0, amdgpu_bo_size(abo));
+	}

Nit pick only, but coding style says to not use "{" "}" in an if without else and only a single line of code.

Additional to that I'm not sure if that's a good idea. The memory allocated here might be already be used and so we need to clear it no matter where it came from.

It's probably easier to just set the AMDGPU_GEM_CREATE_VRAM_CLEARED in the call to amdgpu_gem_object_create(). This makes the GPU clear the memory before the first CPU access to it.

Regards,
Christian.

Quoted 3 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_fb.c +0 -0
   	strcpy(info->fix.id, "amdgpudrmfb");
 

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

A message that is not in the archive (sent off-list or not yet received): 31b35028-f22e-7e59-bcbc-3f6ae85f8d9f-5C7GfCeVMHo@public.gmane.org

#9 lore raw

Thank you for the clarification, I get it.

—
Sincerely Yours,
Pixel

Quoted 8 lines · Christian

Hi Pixel,

you don't seem to understand the reason for the clear here.

It is completely irrelevant that the host is clearing the memory for the guest, the problem is that the guest reuse the memory it got assigned from the host multiple times.

Quoted 63 lines

IIRC we added this because you could see leftovers of the slash screen in the text console when the resolution wasn't a multiple of the character height.

Regards,
Christian.

Am 06.02.2017 um 10:09 schrieb Ding, Pixel:

Quoted 54 lines

Hi Christian,

The underlying host driver clears VF’s framebuffer when guest driver shake hands with it, that is done before guest driver init. I think it’s unnecessary to clear FB again even with GPU for VF.

—
Sincerely Yours,
Pixel

Quoted 40 lines · Christian

Am 06.02.2017 um 07:24 schrieb Pixel Ding:

Quoted 14 lines

The SRIOV host driver cleans framebuffer for each VF, guest driver needn't this action which costs much time on some virtualization platform, otherwise it might get timeout to initialize.

---
   drivers/gpu/drm/amd/amdgpu/amdgpu_fb.c | 4 +++-
   1 file changed, 3 insertions(+), 1 deletion(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_fb.c +0 -0
index 1e735c4..f1eb4f5 100644

drivers/gpu/drm/amd/amdgpu/amdgpu_fb.c static int amdgpufb_create(struct drm_fb_helper *helper, · line 247

Quoted 7 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_fb.c +3 -1
@@ -242,7 +242,9 @@ static int amdgpufb_create(struct drm_fb_helper *helper,
   	/* setup helper */
   	rfbdev->helper.fb = fb;
 
-	memset_io(abo->kptr, 0x0, amdgpu_bo_size(abo));
+	if (!amdgpu_sriov_vf(adev)) {
+		memset_io(abo->kptr, 0x0, amdgpu_bo_size(abo));
+	}

Nit pick only, but coding style says to not use "{" "}" in an if without else and only a single line of code.

Additional to that I'm not sure if that's a good idea. The memory allocated here might be already be used and so we need to clear it no matter where it came from.

It's probably easier to just set the AMDGPU_GEM_CREATE_VRAM_CLEARED in the call to amdgpu_gem_object_create(). This makes the GPU clear the memory before the first CPU access to it.

Regards,
Christian.

Quoted 3 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_fb.c +0 -0
   	strcpy(info->fix.id, "amdgpudrmfb");
 

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

#10 lore raw
In reply to a message not in the archive

Hi Christian,

I think you mean loading KMS multiple times by “reuse”. At every time loading KMS, guest driver tells the host to clear FB during early init. I can’t see a case that fb_probe is invoked out of loading KMS, is there?

Anyway I understand we don’t want to have many SRIOV conditional code paths. If I remove memset_io here and add GPU clear flag, should it be common logic or specific for VF?

—
Sincerely Yours,
Pixel

Quoted 8 lines · Christian

Hi Pixel,

you don't seem to understand the reason for the clear here.

It is completely irrelevant that the host is clearing the memory for the guest, the problem is that the guest reuse the memory it got assigned from the host multiple times.

Quoted 63 lines

IIRC we added this because you could see leftovers of the slash screen in the text console when the resolution wasn't a multiple of the character height.

Regards,
Christian.

Am 06.02.2017 um 10:09 schrieb Ding, Pixel:

Quoted 54 lines

Hi Christian,

The underlying host driver clears VF’s framebuffer when guest driver shake hands with it, that is done before guest driver init. I think it’s unnecessary to clear FB again even with GPU for VF.

—
Sincerely Yours,
Pixel

Quoted 40 lines · Christian

Am 06.02.2017 um 07:24 schrieb Pixel Ding:

Quoted 14 lines

The SRIOV host driver cleans framebuffer for each VF, guest driver needn't this action which costs much time on some virtualization platform, otherwise it might get timeout to initialize.

---
   drivers/gpu/drm/amd/amdgpu/amdgpu_fb.c | 4 +++-
   1 file changed, 3 insertions(+), 1 deletion(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_fb.c +0 -0
index 1e735c4..f1eb4f5 100644

drivers/gpu/drm/amd/amdgpu/amdgpu_fb.c static int amdgpufb_create(struct drm_fb_helper *helper, · line 247

Quoted 7 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_fb.c +3 -1
@@ -242,7 +242,9 @@ static int amdgpufb_create(struct drm_fb_helper *helper,
   	/* setup helper */
   	rfbdev->helper.fb = fb;
 
-	memset_io(abo->kptr, 0x0, amdgpu_bo_size(abo));
+	if (!amdgpu_sriov_vf(adev)) {
+		memset_io(abo->kptr, 0x0, amdgpu_bo_size(abo));
+	}

Nit pick only, but coding style says to not use "{" "}" in an if without else and only a single line of code.

Additional to that I'm not sure if that's a good idea. The memory allocated here might be already be used and so we need to clear it no matter where it came from.

It's probably easier to just set the AMDGPU_GEM_CREATE_VRAM_CLEARED in the call to amdgpu_gem_object_create(). This makes the GPU clear the memory before the first CPU access to it.

Regards,
Christian.

Quoted 3 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_fb.c +0 -0
   	strcpy(info->fix.id, "amdgpudrmfb");
 

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

A message that is not in the archive (sent off-list or not yet received): F12BF8F4-A6D3-4685-A8C8-0D610706836D-5C7GfCeVMHo@public.gmane.org

#12 lore raw
Quoted 1 line

I think you mean loading KMS multiple times by “reuse”.

No, as far as I know the fb emulation can be initialized multiple times without driver reload.

Quoted 1 line

I can’t see a case that fb_probe is invoked out of loading KMS, is there?

I'm not so deeply into this, but I knew that you can certainly unbind and bind again an fb while the driver is still loaded.

I simply assumed that the create function is then called multiple times.

Quoted 1 line

If I remove memset_io here and add GPU clear flag, should it be common logic or specific for VF?

That should be generic and work for all cases. Using the clear flag just lets the GPU clear the memory in the background.

Regards,
Christian.

Am 07.02.2017 um 02:37 schrieb Ding, Pixel:

Quoted 16 lines

Hi Christian,

I think you mean loading KMS multiple times by “reuse”. At every time loading KMS, guest driver tells the host to clear FB during early init. I can’t see a case that fb_probe is invoked out of loading KMS, is there?

Anyway I understand we don’t want to have many SRIOV conditional code paths. If I remove memset_io here and add GPU clear flag, should it be common logic or specific for VF?

—
Sincerely Yours,
Pixel

Quoted 70 lines
Quoted 68 lines · Christian

Hi Pixel,

you don't seem to understand the reason for the clear here.

It is completely irrelevant that the host is clearing the memory for the guest, the problem is that the guest reuse the memory it got assigned from the host multiple times.
IIRC we added this because you could see leftovers of the slash screen in the text console when the resolution wasn't a multiple of the character height.

Regards,
Christian.

Am 06.02.2017 um 10:09 schrieb Ding, Pixel:

Quoted 53 lines

Hi Christian,

The underlying host driver clears VF’s framebuffer when guest driver shake hands with it, that is done before guest driver init. I think it’s unnecessary to clear FB again even with GPU for VF.

—
Sincerely Yours,
Pixel

Quoted 39 lines · Christian

Am 06.02.2017 um 07:24 schrieb Pixel Ding:

Quoted 14 lines

The SRIOV host driver cleans framebuffer for each VF, guest driver needn't this action which costs much time on some virtualization platform, otherwise it might get timeout to initialize.

---
    drivers/gpu/drm/amd/amdgpu/amdgpu_fb.c | 4 +++-
    1 file changed, 3 insertions(+), 1 deletion(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_fb.c +0 -0
index 1e735c4..f1eb4f5 100644

drivers/gpu/drm/amd/amdgpu/amdgpu_fb.c static int amdgpufb_create(struct drm_fb_helper *helper, · line 247

Quoted 7 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_fb.c +3 -1
@@ -242,7 +242,9 @@ static int amdgpufb_create(struct drm_fb_helper *helper,
    	/* setup helper */
    	rfbdev->helper.fb = fb;
 
-	memset_io(abo->kptr, 0x0, amdgpu_bo_size(abo));
+	if (!amdgpu_sriov_vf(adev)) {
+		memset_io(abo->kptr, 0x0, amdgpu_bo_size(abo));
+	}

Nit pick only, but coding style says to not use "{" "}" in an if without else and only a single line of code.

Additional to that I'm not sure if that's a good idea. The memory allocated here might be already be used and so we need to clear it no matter where it came from.

It's probably easier to just set the AMDGPU_GEM_CREATE_VRAM_CLEARED in the call to amdgpu_gem_object_create(). This makes the GPU clear the memory before the first CPU access to it.

Regards,
Christian.

Quoted 3 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_fb.c +0 -0
    	strcpy(info->fix.id, "amdgpudrmfb");
 

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx