public inbox for stable@vger.kernel.org
 help / color / mirror / Atom feed
* Nomination of amdgpu fixes for stable backport
@ 2018-08-16  7:53 Michel Dänzer
  2018-08-16 15:20 ` Greg KH
  2018-09-12  8:55 ` Greg KH
  0 siblings, 2 replies; 12+ messages in thread
From: Michel Dänzer @ 2018-08-16  7:53 UTC (permalink / raw)
  To: stable


Hi stable kernel maintainers,


please squash these amdgpu fixes together and backport them to all
applicable stable branches:

15e6b76880e65be24250e30986084b5569b7a06f "drm/amdgpu: Warn and update
                                          pin_size values when
                                          destroying a pinned BO"
456607d816d89a442a3d5ec98b02c8bc950b5228 "drm/amdgpu: Don't warn on
                                          destroying a pinned BO"

(These depend on commits a5ccfe5c20740f2fbf00291490cdf8d2373ec255 and
ddc21af4d0f37f42b33c54cb69b215997fe5b082, which already have Cc: stable)


-- 
Earthling Michel Dänzer               |               http://www.amd.com
Libre software enthusiast             |             Mesa and X developer

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: Nomination of amdgpu fixes for stable backport
  2018-08-16  7:53 Nomination of amdgpu fixes for stable backport Michel Dänzer
@ 2018-08-16 15:20 ` Greg KH
  2018-08-16 15:36   ` Michel Dänzer
  2018-09-12  8:55 ` Greg KH
  1 sibling, 1 reply; 12+ messages in thread
From: Greg KH @ 2018-08-16 15:20 UTC (permalink / raw)
  To: Michel Dänzer; +Cc: stable

On Thu, Aug 16, 2018 at 09:53:54AM +0200, Michel D�nzer wrote:
> 
> Hi stable kernel maintainers,
> 
> 
> please squash these amdgpu fixes together and backport them to all
> applicable stable branches:

Nothing gets squashed, we apply individual patches :)

> 
> 15e6b76880e65be24250e30986084b5569b7a06f "drm/amdgpu: Warn and update
>                                           pin_size values when
>                                           destroying a pinned BO"
> 456607d816d89a442a3d5ec98b02c8bc950b5228 "drm/amdgpu: Don't warn on
>                                           destroying a pinned BO"
> 
> (These depend on commits a5ccfe5c20740f2fbf00291490cdf8d2373ec255 and
> ddc21af4d0f37f42b33c54cb69b215997fe5b082, which already have Cc: stable)

What stable tree(s) do you want these applied to?

thanks,

greg k-h

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: Nomination of amdgpu fixes for stable backport
  2018-08-16 15:20 ` Greg KH
@ 2018-08-16 15:36   ` Michel Dänzer
  2018-08-16 15:54     ` Greg KH
  0 siblings, 1 reply; 12+ messages in thread
From: Michel Dänzer @ 2018-08-16 15:36 UTC (permalink / raw)
  To: Greg KH; +Cc: stable

On 2018-08-16 05:20 PM, Greg KH wrote:
> On Thu, Aug 16, 2018 at 09:53:54AM +0200, Michel Dänzer wrote:
>>
>> Hi stable kernel maintainers,
>>
>>
>> please squash these amdgpu fixes together and backport them to all
>> applicable stable branches:
> 
> Nothing gets squashed, we apply individual patches :)

That's a bit unfortunate in this case, as there can be spurious WARN
splats with only the first fix.


>> 15e6b76880e65be24250e30986084b5569b7a06f "drm/amdgpu: Warn and update
>>                                           pin_size values when
>>                                           destroying a pinned BO"
>> 456607d816d89a442a3d5ec98b02c8bc950b5228 "drm/amdgpu: Don't warn on
>>                                           destroying a pinned BO"
>>
>> (These depend on commits a5ccfe5c20740f2fbf00291490cdf8d2373ec255 and
>> ddc21af4d0f37f42b33c54cb69b215997fe5b082, which already have Cc: stable)
> 
> What stable tree(s) do you want these applied to?

All active trees where they apply (and so do the patches they depend on).


-- 
Earthling Michel Dänzer               |               http://www.amd.com
Libre software enthusiast             |             Mesa and X developer

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: Nomination of amdgpu fixes for stable backport
  2018-08-16 15:36   ` Michel Dänzer
@ 2018-08-16 15:54     ` Greg KH
  2018-08-16 16:16       ` Michel Dänzer
  2018-09-12  8:39       ` Michel Dänzer
  0 siblings, 2 replies; 12+ messages in thread
From: Greg KH @ 2018-08-16 15:54 UTC (permalink / raw)
  To: Michel Dänzer; +Cc: stable

On Thu, Aug 16, 2018 at 05:36:16PM +0200, Michel D�nzer wrote:
> On 2018-08-16 05:20 PM, Greg KH wrote:
> > On Thu, Aug 16, 2018 at 09:53:54AM +0200, Michel D�nzer wrote:
> >>
> >> Hi stable kernel maintainers,
> >>
> >>
> >> please squash these amdgpu fixes together and backport them to all
> >> applicable stable branches:
> > 
> > Nothing gets squashed, we apply individual patches :)
> 
> That's a bit unfortunate in this case, as there can be spurious WARN
> splats with only the first fix.

That's fine, no one is going to only apply one of them.

> >> 15e6b76880e65be24250e30986084b5569b7a06f "drm/amdgpu: Warn and update
> >>                                           pin_size values when
> >>                                           destroying a pinned BO"
> >> 456607d816d89a442a3d5ec98b02c8bc950b5228 "drm/amdgpu: Don't warn on
> >>                                           destroying a pinned BO"
> >>
> >> (These depend on commits a5ccfe5c20740f2fbf00291490cdf8d2373ec255 and
> >> ddc21af4d0f37f42b33c54cb69b215997fe5b082, which already have Cc: stable)
> > 
> > What stable tree(s) do you want these applied to?
> 
> All active trees where they apply (and so do the patches they depend on).

A hint might be nice here, what trees did you test this on?

thanks,

greg k-h

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: Nomination of amdgpu fixes for stable backport
  2018-08-16 15:54     ` Greg KH
@ 2018-08-16 16:16       ` Michel Dänzer
  2018-09-12  8:39       ` Michel Dänzer
  1 sibling, 0 replies; 12+ messages in thread
From: Michel Dänzer @ 2018-08-16 16:16 UTC (permalink / raw)
  To: Greg KH; +Cc: stable

On 2018-08-16 05:54 PM, Greg KH wrote:
> On Thu, Aug 16, 2018 at 05:36:16PM +0200, Michel Dänzer wrote:
>> On 2018-08-16 05:20 PM, Greg KH wrote:
>>> On Thu, Aug 16, 2018 at 09:53:54AM +0200, Michel Dänzer wrote:
>>>>
>>>> Hi stable kernel maintainers,
>>>>
>>>>
>>>> please squash these amdgpu fixes together and backport them to all
>>>> applicable stable branches:
>>>
>>> Nothing gets squashed, we apply individual patches :)
>>
>> That's a bit unfortunate in this case, as there can be spurious WARN
>> splats with only the first fix.
> 
> That's fine, no one is going to only apply one of them.
> 
>>>> 15e6b76880e65be24250e30986084b5569b7a06f "drm/amdgpu: Warn and update
>>>>                                           pin_size values when
>>>>                                           destroying a pinned BO"
>>>> 456607d816d89a442a3d5ec98b02c8bc950b5228 "drm/amdgpu: Don't warn on
>>>>                                           destroying a pinned BO"
>>>>
>>>> (These depend on commits a5ccfe5c20740f2fbf00291490cdf8d2373ec255 and
>>>> ddc21af4d0f37f42b33c54cb69b215997fe5b082, which already have Cc: stable)
>>>
>>> What stable tree(s) do you want these applied to?
>>
>> All active trees where they apply (and so do the patches they depend on).
> 
> A hint might be nice here, what trees did you test this on?

I didn't test it on any stable trees, but if the patches apply on a
branch, it means they're needed. :)


-- 
Earthling Michel Dänzer               |               http://www.amd.com
Libre software enthusiast             |             Mesa and X developer

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: Nomination of amdgpu fixes for stable backport
  2018-08-16 15:54     ` Greg KH
  2018-08-16 16:16       ` Michel Dänzer
@ 2018-09-12  8:39       ` Michel Dänzer
  2018-09-12  9:02         ` Greg KH
  1 sibling, 1 reply; 12+ messages in thread
From: Michel Dänzer @ 2018-09-12  8:39 UTC (permalink / raw)
  To: Greg KH; +Cc: stable


Hi Greg,


On 2018-08-16 5:54 p.m., Greg KH wrote:
> On Thu, Aug 16, 2018 at 05:36:16PM +0200, Michel Dänzer wrote:
>> On 2018-08-16 05:20 PM, Greg KH wrote:
>>> On Thu, Aug 16, 2018 at 09:53:54AM +0200, Michel Dänzer wrote:
>>>>
>>>> Hi stable kernel maintainers,
>>>>
>>>>
>>>> please squash these amdgpu fixes together and backport them to all
>>>> applicable stable branches:
>>>
>>> Nothing gets squashed, we apply individual patches :)
>>
>> That's a bit unfortunate in this case, as there can be spurious WARN
>> splats with only the first fix.
> 
> That's fine, no one is going to only apply one of them.
> 
>>>> 15e6b76880e65be24250e30986084b5569b7a06f "drm/amdgpu: Warn and update
>>>>                                           pin_size values when
>>>>                                           destroying a pinned BO"
>>>> 456607d816d89a442a3d5ec98b02c8bc950b5228 "drm/amdgpu: Don't warn on
>>>>                                           destroying a pinned BO"
>>>>
>>>> (These depend on commits a5ccfe5c20740f2fbf00291490cdf8d2373ec255 and
>>>> ddc21af4d0f37f42b33c54cb69b215997fe5b082, which already have Cc: stable)
>>>
>>> What stable tree(s) do you want these applied to?
>>
>> All active trees where they apply (and so do the patches they depend on).
> 
> A hint might be nice here, what trees did you test this on?

Is there a reason why these 4 fixes haven't been backported yet? People
are running into the issues fixed by them.

There seem to be many other fixes under drivers/gpu/drm/ with Cc: stable
which haven't been backported yet.


Thanks,


-- 
Earthling Michel Dänzer               |               http://www.amd.com
Libre software enthusiast             |             Mesa and X developer

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: Nomination of amdgpu fixes for stable backport
  2018-08-16  7:53 Nomination of amdgpu fixes for stable backport Michel Dänzer
  2018-08-16 15:20 ` Greg KH
@ 2018-09-12  8:55 ` Greg KH
  2018-09-12  9:11   ` Michel Dänzer
  1 sibling, 1 reply; 12+ messages in thread
From: Greg KH @ 2018-09-12  8:55 UTC (permalink / raw)
  To: Michel Dänzer; +Cc: stable

On Thu, Aug 16, 2018 at 09:53:54AM +0200, Michel D�nzer wrote:
> 
> Hi stable kernel maintainers,
> 
> 
> please squash these amdgpu fixes together and backport them to all
> applicable stable branches:
> 
> 15e6b76880e65be24250e30986084b5569b7a06f "drm/amdgpu: Warn and update
>                                           pin_size values when
>                                           destroying a pinned BO"
> 456607d816d89a442a3d5ec98b02c8bc950b5228 "drm/amdgpu: Don't warn on
>                                           destroying a pinned BO"
> 
> (These depend on commits a5ccfe5c20740f2fbf00291490cdf8d2373ec255 and
> ddc21af4d0f37f42b33c54cb69b215997fe5b082, which already have Cc: stable)

Those commits did not apply to the stable tree, so can you please send a
series of patches that do apply so that I can queue all of these up
properly?

thanks,

greg k-h

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: Nomination of amdgpu fixes for stable backport
  2018-09-12  8:39       ` Michel Dänzer
@ 2018-09-12  9:02         ` Greg KH
  0 siblings, 0 replies; 12+ messages in thread
From: Greg KH @ 2018-09-12  9:02 UTC (permalink / raw)
  To: Michel Dänzer; +Cc: stable

On Wed, Sep 12, 2018 at 10:39:56AM +0200, Michel D�nzer wrote:
> 
> Hi Greg,
> 
> 
> On 2018-08-16 5:54 p.m., Greg KH wrote:
> > On Thu, Aug 16, 2018 at 05:36:16PM +0200, Michel D�nzer wrote:
> >> On 2018-08-16 05:20 PM, Greg KH wrote:
> >>> On Thu, Aug 16, 2018 at 09:53:54AM +0200, Michel D�nzer wrote:
> >>>>
> >>>> Hi stable kernel maintainers,
> >>>>
> >>>>
> >>>> please squash these amdgpu fixes together and backport them to all
> >>>> applicable stable branches:
> >>>
> >>> Nothing gets squashed, we apply individual patches :)
> >>
> >> That's a bit unfortunate in this case, as there can be spurious WARN
> >> splats with only the first fix.
> > 
> > That's fine, no one is going to only apply one of them.
> > 
> >>>> 15e6b76880e65be24250e30986084b5569b7a06f "drm/amdgpu: Warn and update
> >>>>                                           pin_size values when
> >>>>                                           destroying a pinned BO"
> >>>> 456607d816d89a442a3d5ec98b02c8bc950b5228 "drm/amdgpu: Don't warn on
> >>>>                                           destroying a pinned BO"
> >>>>
> >>>> (These depend on commits a5ccfe5c20740f2fbf00291490cdf8d2373ec255 and
> >>>> ddc21af4d0f37f42b33c54cb69b215997fe5b082, which already have Cc: stable)
> >>>
> >>> What stable tree(s) do you want these applied to?
> >>
> >> All active trees where they apply (and so do the patches they depend on).
> > 
> > A hint might be nice here, what trees did you test this on?
> 
> Is there a reason why these 4 fixes haven't been backported yet? People
> are running into the issues fixed by them.
> 
> There seem to be many other fixes under drivers/gpu/drm/ with Cc: stable
> which haven't been backported yet.

Ah, our emails crossed.  I just tried to apply these, but the original
ones all failed to apply :(

And I normally wait for the drm patches to go "last" for the stable
trees due to all of the merge issues they normally cause, like this :(

greg k-h

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: Nomination of amdgpu fixes for stable backport
  2018-09-12  8:55 ` Greg KH
@ 2018-09-12  9:11   ` Michel Dänzer
  2018-09-12  9:16     ` Greg KH
  0 siblings, 1 reply; 12+ messages in thread
From: Michel Dänzer @ 2018-09-12  9:11 UTC (permalink / raw)
  To: Greg KH; +Cc: stable

On 2018-09-12 10:55 a.m., Greg KH wrote:
> On Thu, Aug 16, 2018 at 09:53:54AM +0200, Michel Dänzer wrote:
>>
>> Hi stable kernel maintainers,
>>
>>
>> please squash these amdgpu fixes together and backport them to all
>> applicable stable branches:
>>
>> 15e6b76880e65be24250e30986084b5569b7a06f "drm/amdgpu: Warn and update
>>                                           pin_size values when
>>                                           destroying a pinned BO"
>> 456607d816d89a442a3d5ec98b02c8bc950b5228 "drm/amdgpu: Don't warn on
>>                                           destroying a pinned BO"
>>
>> (These depend on commits a5ccfe5c20740f2fbf00291490cdf8d2373ec255 and
>> ddc21af4d0f37f42b33c54cb69b215997fe5b082, which already have Cc: stable)
> 
> Those commits did not apply to the stable tree, so can you please send a
> series of patches that do apply so that I can queue all of these up
> properly?

Just keep the

	if (adev->gmc.visible_vram_size == adev->gmc.real_vram_size)

line in the backport of ddc21af4d0f37f42b33c54cb69b215997fe5b082. The
remaining 3 should apply fine AFAICT.


-- 
Earthling Michel Dänzer               |               http://www.amd.com
Libre software enthusiast             |             Mesa and X developer

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: Nomination of amdgpu fixes for stable backport
  2018-09-12  9:11   ` Michel Dänzer
@ 2018-09-12  9:16     ` Greg KH
  2018-09-12  9:28       ` Michel Dänzer
  0 siblings, 1 reply; 12+ messages in thread
From: Greg KH @ 2018-09-12  9:16 UTC (permalink / raw)
  To: Michel Dänzer; +Cc: stable

On Wed, Sep 12, 2018 at 11:11:54AM +0200, Michel D�nzer wrote:
> On 2018-09-12 10:55 a.m., Greg KH wrote:
> > On Thu, Aug 16, 2018 at 09:53:54AM +0200, Michel D�nzer wrote:
> >>
> >> Hi stable kernel maintainers,
> >>
> >>
> >> please squash these amdgpu fixes together and backport them to all
> >> applicable stable branches:
> >>
> >> 15e6b76880e65be24250e30986084b5569b7a06f "drm/amdgpu: Warn and update
> >>                                           pin_size values when
> >>                                           destroying a pinned BO"
> >> 456607d816d89a442a3d5ec98b02c8bc950b5228 "drm/amdgpu: Don't warn on
> >>                                           destroying a pinned BO"
> >>
> >> (These depend on commits a5ccfe5c20740f2fbf00291490cdf8d2373ec255 and
> >> ddc21af4d0f37f42b33c54cb69b215997fe5b082, which already have Cc: stable)
> > 
> > Those commits did not apply to the stable tree, so can you please send a
> > series of patches that do apply so that I can queue all of these up
> > properly?
> 
> Just keep the
> 
> 	if (adev->gmc.visible_vram_size == adev->gmc.real_vram_size)
> 
> line in the backport of ddc21af4d0f37f42b33c54cb69b215997fe5b082. The
> remaining 3 should apply fine AFAICT.

Can you provide a patch that does that?  I don't have the resources to
hand-edit diffs in order to get them to apply.  I also, almost always,
when I have tried to do this, get it wrong :)

thanks,

greg k-h

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: Nomination of amdgpu fixes for stable backport
  2018-09-12  9:16     ` Greg KH
@ 2018-09-12  9:28       ` Michel Dänzer
  2018-09-12 18:43         ` Greg KH
  0 siblings, 1 reply; 12+ messages in thread
From: Michel Dänzer @ 2018-09-12  9:28 UTC (permalink / raw)
  To: Greg KH; +Cc: stable

[-- Attachment #1: Type: text/plain, Size: 1717 bytes --]

On 2018-09-12 11:16 a.m., Greg KH wrote:
> On Wed, Sep 12, 2018 at 11:11:54AM +0200, Michel Dänzer wrote:
>> On 2018-09-12 10:55 a.m., Greg KH wrote:
>>> On Thu, Aug 16, 2018 at 09:53:54AM +0200, Michel Dänzer wrote:
>>>>
>>>> Hi stable kernel maintainers,
>>>>
>>>>
>>>> please squash these amdgpu fixes together and backport them to all
>>>> applicable stable branches:
>>>>
>>>> 15e6b76880e65be24250e30986084b5569b7a06f "drm/amdgpu: Warn and update
>>>>                                           pin_size values when
>>>>                                           destroying a pinned BO"
>>>> 456607d816d89a442a3d5ec98b02c8bc950b5228 "drm/amdgpu: Don't warn on
>>>>                                           destroying a pinned BO"
>>>>
>>>> (These depend on commits a5ccfe5c20740f2fbf00291490cdf8d2373ec255 and
>>>> ddc21af4d0f37f42b33c54cb69b215997fe5b082, which already have Cc: stable)
>>>
>>> Those commits did not apply to the stable tree, so can you please send a
>>> series of patches that do apply so that I can queue all of these up
>>> properly?
>>
>> Just keep the
>>
>> 	if (adev->gmc.visible_vram_size == adev->gmc.real_vram_size)
>>
>> line in the backport of ddc21af4d0f37f42b33c54cb69b215997fe5b082. The
>> remaining 3 should apply fine AFAICT.
> 
> Can you provide a patch that does that?  I don't have the resources to
> hand-edit diffs in order to get them to apply.  I also, almost always,
> when I have tried to do this, get it wrong :)

Sure, attached. Sorry about the trouble, the conflict was due to a
helper function added upstream.


-- 
Earthling Michel Dänzer               |               http://www.amd.com
Libre software enthusiast             |             Mesa and X developer

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0001-drm-amdgpu-Keep-track-of-amount-of-pinned-CPU-visibl.patch --]
[-- Type: text/x-patch; name="0001-drm-amdgpu-Keep-track-of-amount-of-pinned-CPU-visibl.patch", Size: 6410 bytes --]

From eb418a9f3275a87e4b274af11dc6f9a357c50736 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Michel=20D=C3=A4nzer?= <michel.daenzer@amd.com>
Date: Wed, 12 Sep 2018 11:21:37 +0200
Subject: [PATCH] drm/amdgpu: Keep track of amount of pinned CPU visible VRAM
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

Instead of CPU invisible VRAM. Preparation for the following, no
functional change intended.

v2:
* Also change amdgpu_vram_mgr_bo_invisible_size to
  amdgpu_vram_mgr_bo_visible_size, allowing further simplification
  (Christian König)

Cc: stable@vger.kernel.org
Reviewed-by: Christian König <christian.koenig@amd.com>
Signed-off-by: Michel Dänzer <michel.daenzer@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
(Cherry picked from commit ddc21af4d0f37f42b33c54cb69b215997fe5b082)
---
 drivers/gpu/drm/amd/amdgpu/amdgpu.h          |  2 +-
 drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c      |  5 ++---
 drivers/gpu/drm/amd/amdgpu/amdgpu_object.c   |  4 ++--
 drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.h      |  2 +-
 drivers/gpu/drm/amd/amdgpu/amdgpu_vram_mgr.c | 20 ++++++++------------
 5 files changed, 14 insertions(+), 19 deletions(-)

diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu.h b/drivers/gpu/drm/amd/amdgpu/amdgpu.h
index 7dcbac8af9a7..e59d31ea2999 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu.h
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu.h
@@ -1580,7 +1580,7 @@ struct amdgpu_device {
 
 	/* tracking pinned memory */
 	u64 vram_pin_size;
-	u64 invisible_pin_size;
+	u64 visible_pin_size;
 	u64 gart_pin_size;
 
 	/* amdkfd interface */
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c
index 91517b166a3b..ea9aa220833b 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c
@@ -497,7 +497,7 @@ static int amdgpu_info_ioctl(struct drm_device *dev, void *data, struct drm_file
 		vram_gtt.vram_size = adev->gmc.real_vram_size;
 		vram_gtt.vram_size -= adev->vram_pin_size;
 		vram_gtt.vram_cpu_accessible_size = adev->gmc.visible_vram_size;
-		vram_gtt.vram_cpu_accessible_size -= (adev->vram_pin_size - adev->invisible_pin_size);
+		vram_gtt.vram_cpu_accessible_size -= adev->visible_pin_size;
 		vram_gtt.gtt_size = adev->mman.bdev.man[TTM_PL_TT].size;
 		vram_gtt.gtt_size *= PAGE_SIZE;
 		vram_gtt.gtt_size -= adev->gart_pin_size;
@@ -518,8 +518,7 @@ static int amdgpu_info_ioctl(struct drm_device *dev, void *data, struct drm_file
 		mem.cpu_accessible_vram.total_heap_size =
 			adev->gmc.visible_vram_size;
 		mem.cpu_accessible_vram.usable_heap_size =
-			adev->gmc.visible_vram_size -
-			(adev->vram_pin_size - adev->invisible_pin_size);
+			adev->gmc.visible_vram_size - adev->visible_pin_size;
 		mem.cpu_accessible_vram.heap_usage =
 			amdgpu_vram_mgr_vis_usage(&adev->mman.bdev.man[TTM_PL_VRAM]);
 		mem.cpu_accessible_vram.max_allocation =
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_object.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_object.c
index 3526efa8960e..9a08b249942d 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_object.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_object.c
@@ -762,7 +762,7 @@ int amdgpu_bo_pin_restricted(struct amdgpu_bo *bo, u32 domain,
 	domain = amdgpu_mem_type_to_domain(bo->tbo.mem.mem_type);
 	if (domain == AMDGPU_GEM_DOMAIN_VRAM) {
 		adev->vram_pin_size += amdgpu_bo_size(bo);
-		adev->invisible_pin_size += amdgpu_vram_mgr_bo_invisible_size(bo);
+		adev->visible_pin_size += amdgpu_vram_mgr_bo_visible_size(bo);
 	} else if (domain == AMDGPU_GEM_DOMAIN_GTT) {
 		adev->gart_pin_size += amdgpu_bo_size(bo);
 	}
@@ -792,7 +792,7 @@ int amdgpu_bo_unpin(struct amdgpu_bo *bo)
 
 	if (bo->tbo.mem.mem_type == TTM_PL_VRAM) {
 		adev->vram_pin_size -= amdgpu_bo_size(bo);
-		adev->invisible_pin_size -= amdgpu_vram_mgr_bo_invisible_size(bo);
+		adev->visible_pin_size -= amdgpu_vram_mgr_bo_visible_size(bo);
 	} else if (bo->tbo.mem.mem_type == TTM_PL_TT) {
 		adev->gart_pin_size -= amdgpu_bo_size(bo);
 	}
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.h b/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.h
index e5da4654b630..8b3cc6687769 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.h
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.h
@@ -73,7 +73,7 @@ bool amdgpu_gtt_mgr_has_gart_addr(struct ttm_mem_reg *mem);
 uint64_t amdgpu_gtt_mgr_usage(struct ttm_mem_type_manager *man);
 int amdgpu_gtt_mgr_recover(struct ttm_mem_type_manager *man);
 
-u64 amdgpu_vram_mgr_bo_invisible_size(struct amdgpu_bo *bo);
+u64 amdgpu_vram_mgr_bo_visible_size(struct amdgpu_bo *bo);
 uint64_t amdgpu_vram_mgr_usage(struct ttm_mem_type_manager *man);
 uint64_t amdgpu_vram_mgr_vis_usage(struct ttm_mem_type_manager *man);
 
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_vram_mgr.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_vram_mgr.c
index b6333f92ba45..ef4784458800 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_vram_mgr.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_vram_mgr.c
@@ -97,33 +97,29 @@ static u64 amdgpu_vram_mgr_vis_size(struct amdgpu_device *adev,
 }
 
 /**
- * amdgpu_vram_mgr_bo_invisible_size - CPU invisible BO size
+ * amdgpu_vram_mgr_bo_visible_size - CPU visible BO size
  *
  * @bo: &amdgpu_bo buffer object (must be in VRAM)
  *
  * Returns:
- * How much of the given &amdgpu_bo buffer object lies in CPU invisible VRAM.
+ * How much of the given &amdgpu_bo buffer object lies in CPU visible VRAM.
  */
-u64 amdgpu_vram_mgr_bo_invisible_size(struct amdgpu_bo *bo)
+u64 amdgpu_vram_mgr_bo_visible_size(struct amdgpu_bo *bo)
 {
 	struct amdgpu_device *adev = amdgpu_ttm_adev(bo->tbo.bdev);
 	struct ttm_mem_reg *mem = &bo->tbo.mem;
 	struct drm_mm_node *nodes = mem->mm_node;
 	unsigned pages = mem->num_pages;
-	u64 usage = 0;
+	u64 usage;
 
 	if (adev->gmc.visible_vram_size == adev->gmc.real_vram_size)
-		return 0;
+		return amdgpu_bo_size(bo);
 
 	if (mem->start >= adev->gmc.visible_vram_size >> PAGE_SHIFT)
-		return amdgpu_bo_size(bo);
+		return 0;
 
-	while (nodes && pages) {
-		usage += nodes->size << PAGE_SHIFT;
-		usage -= amdgpu_vram_mgr_vis_size(adev, nodes);
-		pages -= nodes->size;
-		++nodes;
-	}
+	for (usage = 0; nodes && pages; pages -= nodes->size, nodes++)
+		usage += amdgpu_vram_mgr_vis_size(adev, nodes);
 
 	return usage;
 }
-- 
2.19.0.rc2


^ permalink raw reply related	[flat|nested] 12+ messages in thread

* Re: Nomination of amdgpu fixes for stable backport
  2018-09-12  9:28       ` Michel Dänzer
@ 2018-09-12 18:43         ` Greg KH
  0 siblings, 0 replies; 12+ messages in thread
From: Greg KH @ 2018-09-12 18:43 UTC (permalink / raw)
  To: Michel Dänzer; +Cc: stable

On Wed, Sep 12, 2018 at 11:28:01AM +0200, Michel D�nzer wrote:
> On 2018-09-12 11:16 a.m., Greg KH wrote:
> > On Wed, Sep 12, 2018 at 11:11:54AM +0200, Michel D�nzer wrote:
> >> On 2018-09-12 10:55 a.m., Greg KH wrote:
> >>> On Thu, Aug 16, 2018 at 09:53:54AM +0200, Michel D�nzer wrote:
> >>>>
> >>>> Hi stable kernel maintainers,
> >>>>
> >>>>
> >>>> please squash these amdgpu fixes together and backport them to all
> >>>> applicable stable branches:
> >>>>
> >>>> 15e6b76880e65be24250e30986084b5569b7a06f "drm/amdgpu: Warn and update
> >>>>                                           pin_size values when
> >>>>                                           destroying a pinned BO"
> >>>> 456607d816d89a442a3d5ec98b02c8bc950b5228 "drm/amdgpu: Don't warn on
> >>>>                                           destroying a pinned BO"
> >>>>
> >>>> (These depend on commits a5ccfe5c20740f2fbf00291490cdf8d2373ec255 and
> >>>> ddc21af4d0f37f42b33c54cb69b215997fe5b082, which already have Cc: stable)
> >>>
> >>> Those commits did not apply to the stable tree, so can you please send a
> >>> series of patches that do apply so that I can queue all of these up
> >>> properly?
> >>
> >> Just keep the
> >>
> >> 	if (adev->gmc.visible_vram_size == adev->gmc.real_vram_size)
> >>
> >> line in the backport of ddc21af4d0f37f42b33c54cb69b215997fe5b082. The
> >> remaining 3 should apply fine AFAICT.
> > 
> > Can you provide a patch that does that?  I don't have the resources to
> > hand-edit diffs in order to get them to apply.  I also, almost always,
> > when I have tried to do this, get it wrong :)
> 
> Sure, attached. Sorry about the trouble, the conflict was due to a
> helper function added upstream.

Thanks for the backport, all are now queued up.

greg k-h

^ permalink raw reply	[flat|nested] 12+ messages in thread

end of thread, other threads:[~2018-09-12 23:49 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-08-16  7:53 Nomination of amdgpu fixes for stable backport Michel Dänzer
2018-08-16 15:20 ` Greg KH
2018-08-16 15:36   ` Michel Dänzer
2018-08-16 15:54     ` Greg KH
2018-08-16 16:16       ` Michel Dänzer
2018-09-12  8:39       ` Michel Dänzer
2018-09-12  9:02         ` Greg KH
2018-09-12  8:55 ` Greg KH
2018-09-12  9:11   ` Michel Dänzer
2018-09-12  9:16     ` Greg KH
2018-09-12  9:28       ` Michel Dänzer
2018-09-12 18:43         ` Greg KH

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox