diff mbox

[1/2] drm/ttm: remove unused placement flags

Message ID 1473342102-324-1-git-send-email-deathsimple@vodafone.de (mailing list archive)
State New, archived
Headers show

Commit Message

Christian König Sept. 8, 2016, 1:41 p.m. UTC
From: Christian König <christian.koenig@amd.com>

Either never used or not used in quite a while.

Signed-off-by: Christian König <christian.koenig@amd.com>
---
 drivers/gpu/drm/ttm/ttm_bo.c    |  2 +-
 include/drm/ttm/ttm_placement.h | 19 -------------------
 2 files changed, 1 insertion(+), 20 deletions(-)

Comments

Chunming Zhou Sept. 9, 2016, 6:41 a.m. UTC | #1
On 2016年09月08日 21:41, Christian König wrote:
> From: Christian König <christian.koenig@amd.com>
>
> Either never used or not used in quite a while.
No, I remember Flora's Direct GMA is using them like GDS use PRIV0-2. 
And you cannot make sure there isn't no one using them in other closed 
projects, right?
If you removed now, that obviously will break her implementation and 
brings  her many troubles.


Regards,
David Zhou
>
> Signed-off-by: Christian König <christian.koenig@amd.com>
> ---
>   drivers/gpu/drm/ttm/ttm_bo.c    |  2 +-
>   include/drm/ttm/ttm_placement.h | 19 -------------------
>   2 files changed, 1 insertion(+), 20 deletions(-)
>
> diff --git a/drivers/gpu/drm/ttm/ttm_bo.c b/drivers/gpu/drm/ttm/ttm_bo.c
> index bc37f02..4d2e8f2 100644
> --- a/drivers/gpu/drm/ttm/ttm_bo.c
> +++ b/drivers/gpu/drm/ttm/ttm_bo.c
> @@ -59,7 +59,7 @@ static inline int ttm_mem_type_from_place(const struct ttm_place *place,
>   {
>   	int i;
>   
> -	for (i = 0; i <= TTM_PL_PRIV5; i++)
> +	for (i = 0; i <= TTM_PL_PRIV2; i++)
>   		if (place->flags & (1 << i)) {
>   			*mem_type = i;
>   			return 0;
> diff --git a/include/drm/ttm/ttm_placement.h b/include/drm/ttm/ttm_placement.h
> index 8ed44f9..20219d9 100644
> --- a/include/drm/ttm/ttm_placement.h
> +++ b/include/drm/ttm/ttm_placement.h
> @@ -40,10 +40,6 @@
>   #define TTM_PL_PRIV0            3
>   #define TTM_PL_PRIV1            4
>   #define TTM_PL_PRIV2            5
> -#define TTM_PL_PRIV3            6
> -#define TTM_PL_PRIV4            7
> -#define TTM_PL_PRIV5            8
> -#define TTM_PL_SWAPPED          15
>   
>   #define TTM_PL_FLAG_SYSTEM      (1 << TTM_PL_SYSTEM)
>   #define TTM_PL_FLAG_TT          (1 << TTM_PL_TT)
> @@ -51,10 +47,6 @@
>   #define TTM_PL_FLAG_PRIV0       (1 << TTM_PL_PRIV0)
>   #define TTM_PL_FLAG_PRIV1       (1 << TTM_PL_PRIV1)
>   #define TTM_PL_FLAG_PRIV2       (1 << TTM_PL_PRIV2)
> -#define TTM_PL_FLAG_PRIV3       (1 << TTM_PL_PRIV3)
> -#define TTM_PL_FLAG_PRIV4       (1 << TTM_PL_PRIV4)
> -#define TTM_PL_FLAG_PRIV5       (1 << TTM_PL_PRIV5)
> -#define TTM_PL_FLAG_SWAPPED     (1 << TTM_PL_SWAPPED)
>   #define TTM_PL_MASK_MEM         0x0000FFFF
>   
>   /*
> @@ -72,7 +64,6 @@
>   #define TTM_PL_FLAG_CACHED      (1 << 16)
>   #define TTM_PL_FLAG_UNCACHED    (1 << 17)
>   #define TTM_PL_FLAG_WC          (1 << 18)
> -#define TTM_PL_FLAG_SHARED      (1 << 20)
>   #define TTM_PL_FLAG_NO_EVICT    (1 << 21)
>   #define TTM_PL_FLAG_TOPDOWN     (1 << 22)
>   
> @@ -82,14 +73,4 @@
>   
>   #define TTM_PL_MASK_MEMTYPE     (TTM_PL_MASK_MEM | TTM_PL_MASK_CACHING)
>   
> -/*
> - * Access flags to be used for CPU- and GPU- mappings.
> - * The idea is that the TTM synchronization mechanism will
> - * allow concurrent READ access and exclusive write access.
> - * Currently GPU- and CPU accesses are exclusive.
> - */
> -
> -#define TTM_ACCESS_READ         (1 << 0)
> -#define TTM_ACCESS_WRITE        (1 << 1)
> -
>   #endif
Flora Cui Sept. 9, 2016, 7:01 a.m. UTC | #2
yes. please don't do this, I need them.

On Fri, Sep 09, 2016 at 02:41:16PM +0800, zhoucm1 wrote:
> 
> 
> On 2016年09月08日 21:41, Christian König wrote:
> >From: Christian König <christian.koenig@amd.com>
> >
> >Either never used or not used in quite a while.
> No, I remember Flora's Direct GMA is using them like GDS use PRIV0-2. And
> you cannot make sure there isn't no one using them in other closed projects,
> right?
> If you removed now, that obviously will break her implementation and brings
> her many troubles.
> 
> 
> Regards,
> David Zhou
> >
> >Signed-off-by: Christian König <christian.koenig@amd.com>
> >---
> >  drivers/gpu/drm/ttm/ttm_bo.c    |  2 +-
> >  include/drm/ttm/ttm_placement.h | 19 -------------------
> >  2 files changed, 1 insertion(+), 20 deletions(-)
> >
> >diff --git a/drivers/gpu/drm/ttm/ttm_bo.c b/drivers/gpu/drm/ttm/ttm_bo.c
> >index bc37f02..4d2e8f2 100644
> >--- a/drivers/gpu/drm/ttm/ttm_bo.c
> >+++ b/drivers/gpu/drm/ttm/ttm_bo.c
> >@@ -59,7 +59,7 @@ static inline int ttm_mem_type_from_place(const struct ttm_place *place,
> >  {
> >  	int i;
> >-	for (i = 0; i <= TTM_PL_PRIV5; i++)
> >+	for (i = 0; i <= TTM_PL_PRIV2; i++)
> >  		if (place->flags & (1 << i)) {
> >  			*mem_type = i;
> >  			return 0;
> >diff --git a/include/drm/ttm/ttm_placement.h b/include/drm/ttm/ttm_placement.h
> >index 8ed44f9..20219d9 100644
> >--- a/include/drm/ttm/ttm_placement.h
> >+++ b/include/drm/ttm/ttm_placement.h
> >@@ -40,10 +40,6 @@
> >  #define TTM_PL_PRIV0            3
> >  #define TTM_PL_PRIV1            4
> >  #define TTM_PL_PRIV2            5
> >-#define TTM_PL_PRIV3            6
> >-#define TTM_PL_PRIV4            7
> >-#define TTM_PL_PRIV5            8
> >-#define TTM_PL_SWAPPED          15
> >  #define TTM_PL_FLAG_SYSTEM      (1 << TTM_PL_SYSTEM)
> >  #define TTM_PL_FLAG_TT          (1 << TTM_PL_TT)
> >@@ -51,10 +47,6 @@
> >  #define TTM_PL_FLAG_PRIV0       (1 << TTM_PL_PRIV0)
> >  #define TTM_PL_FLAG_PRIV1       (1 << TTM_PL_PRIV1)
> >  #define TTM_PL_FLAG_PRIV2       (1 << TTM_PL_PRIV2)
> >-#define TTM_PL_FLAG_PRIV3       (1 << TTM_PL_PRIV3)
> >-#define TTM_PL_FLAG_PRIV4       (1 << TTM_PL_PRIV4)
> >-#define TTM_PL_FLAG_PRIV5       (1 << TTM_PL_PRIV5)
> >-#define TTM_PL_FLAG_SWAPPED     (1 << TTM_PL_SWAPPED)
> >  #define TTM_PL_MASK_MEM         0x0000FFFF
> >  /*
> >@@ -72,7 +64,6 @@
> >  #define TTM_PL_FLAG_CACHED      (1 << 16)
> >  #define TTM_PL_FLAG_UNCACHED    (1 << 17)
> >  #define TTM_PL_FLAG_WC          (1 << 18)
> >-#define TTM_PL_FLAG_SHARED      (1 << 20)
> >  #define TTM_PL_FLAG_NO_EVICT    (1 << 21)
> >  #define TTM_PL_FLAG_TOPDOWN     (1 << 22)
> >@@ -82,14 +73,4 @@
> >  #define TTM_PL_MASK_MEMTYPE     (TTM_PL_MASK_MEM | TTM_PL_MASK_CACHING)
> >-/*
> >- * Access flags to be used for CPU- and GPU- mappings.
> >- * The idea is that the TTM synchronization mechanism will
> >- * allow concurrent READ access and exclusive write access.
> >- * Currently GPU- and CPU accesses are exclusive.
> >- */
> >-
> >-#define TTM_ACCESS_READ         (1 << 0)
> >-#define TTM_ACCESS_WRITE        (1 << 1)
> >-
> >  #endif
> 
> _______________________________________________
> amd-gfx mailing list
> amd-gfx@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/amd-gfx
Christian König Sept. 9, 2016, 9:06 a.m. UTC | #3
In this case please just add them back in your tree. That should be a 
two liner.

For upstream it certainly doesn't make sense to keep them.

Regards,
Christian.

Am 09.09.2016 um 09:01 schrieb Flora Cui:
> yes. please don't do this, I need them.
>
> On Fri, Sep 09, 2016 at 02:41:16PM +0800, zhoucm1 wrote:
>>
>> On 2016年09月08日 21:41, Christian König wrote:
>>> From: Christian König <christian.koenig@amd.com>
>>>
>>> Either never used or not used in quite a while.
>> No, I remember Flora's Direct GMA is using them like GDS use PRIV0-2. And
>> you cannot make sure there isn't no one using them in other closed projects,
>> right?
>> If you removed now, that obviously will break her implementation and brings
>> her many troubles.
>>
>>
>> Regards,
>> David Zhou
>>> Signed-off-by: Christian König <christian.koenig@amd.com>
>>> ---
>>>   drivers/gpu/drm/ttm/ttm_bo.c    |  2 +-
>>>   include/drm/ttm/ttm_placement.h | 19 -------------------
>>>   2 files changed, 1 insertion(+), 20 deletions(-)
>>>
>>> diff --git a/drivers/gpu/drm/ttm/ttm_bo.c b/drivers/gpu/drm/ttm/ttm_bo.c
>>> index bc37f02..4d2e8f2 100644
>>> --- a/drivers/gpu/drm/ttm/ttm_bo.c
>>> +++ b/drivers/gpu/drm/ttm/ttm_bo.c
>>> @@ -59,7 +59,7 @@ static inline int ttm_mem_type_from_place(const struct ttm_place *place,
>>>   {
>>>   	int i;
>>> -	for (i = 0; i <= TTM_PL_PRIV5; i++)
>>> +	for (i = 0; i <= TTM_PL_PRIV2; i++)
>>>   		if (place->flags & (1 << i)) {
>>>   			*mem_type = i;
>>>   			return 0;
>>> diff --git a/include/drm/ttm/ttm_placement.h b/include/drm/ttm/ttm_placement.h
>>> index 8ed44f9..20219d9 100644
>>> --- a/include/drm/ttm/ttm_placement.h
>>> +++ b/include/drm/ttm/ttm_placement.h
>>> @@ -40,10 +40,6 @@
>>>   #define TTM_PL_PRIV0            3
>>>   #define TTM_PL_PRIV1            4
>>>   #define TTM_PL_PRIV2            5
>>> -#define TTM_PL_PRIV3            6
>>> -#define TTM_PL_PRIV4            7
>>> -#define TTM_PL_PRIV5            8
>>> -#define TTM_PL_SWAPPED          15
>>>   #define TTM_PL_FLAG_SYSTEM      (1 << TTM_PL_SYSTEM)
>>>   #define TTM_PL_FLAG_TT          (1 << TTM_PL_TT)
>>> @@ -51,10 +47,6 @@
>>>   #define TTM_PL_FLAG_PRIV0       (1 << TTM_PL_PRIV0)
>>>   #define TTM_PL_FLAG_PRIV1       (1 << TTM_PL_PRIV1)
>>>   #define TTM_PL_FLAG_PRIV2       (1 << TTM_PL_PRIV2)
>>> -#define TTM_PL_FLAG_PRIV3       (1 << TTM_PL_PRIV3)
>>> -#define TTM_PL_FLAG_PRIV4       (1 << TTM_PL_PRIV4)
>>> -#define TTM_PL_FLAG_PRIV5       (1 << TTM_PL_PRIV5)
>>> -#define TTM_PL_FLAG_SWAPPED     (1 << TTM_PL_SWAPPED)
>>>   #define TTM_PL_MASK_MEM         0x0000FFFF
>>>   /*
>>> @@ -72,7 +64,6 @@
>>>   #define TTM_PL_FLAG_CACHED      (1 << 16)
>>>   #define TTM_PL_FLAG_UNCACHED    (1 << 17)
>>>   #define TTM_PL_FLAG_WC          (1 << 18)
>>> -#define TTM_PL_FLAG_SHARED      (1 << 20)
>>>   #define TTM_PL_FLAG_NO_EVICT    (1 << 21)
>>>   #define TTM_PL_FLAG_TOPDOWN     (1 << 22)
>>> @@ -82,14 +73,4 @@
>>>   #define TTM_PL_MASK_MEMTYPE     (TTM_PL_MASK_MEM | TTM_PL_MASK_CACHING)
>>> -/*
>>> - * Access flags to be used for CPU- and GPU- mappings.
>>> - * The idea is that the TTM synchronization mechanism will
>>> - * allow concurrent READ access and exclusive write access.
>>> - * Currently GPU- and CPU accesses are exclusive.
>>> - */
>>> -
>>> -#define TTM_ACCESS_READ         (1 << 0)
>>> -#define TTM_ACCESS_WRITE        (1 << 1)
>>> -
>>>   #endif
>> _______________________________________________
>> amd-gfx mailing list
>> amd-gfx@lists.freedesktop.org
>> https://lists.freedesktop.org/mailman/listinfo/amd-gfx
Zhang, Hawking Sept. 9, 2016, 10:21 a.m. UTC | #4
Hi Chris,

Removing the flag will make ttm_mem_type_from_place skip counting the corresponding placement and thus have impact on mem region create and bo movement. There is no guarantee that amdgpu would never introduce new memory domain in future. In such case, I'd like to vote for keeping these flags instead of adding them back when amdgpu need to add new memory domain.

As you mentioned that it just a two liner. And there is actually no functionality break with these flags. Then how about keep these flags?

Regards,
Hawking

-----Original Message-----
From: amd-gfx [mailto:amd-gfx-bounces@lists.freedesktop.org] On Behalf Of Christian K?nig

Sent: Friday, September 09, 2016 17:07
To: Cui, Flora <Flora.Cui@amd.com>; Zhou, David(ChunMing) <David1.Zhou@amd.com>
Cc: amd-gfx@lists.freedesktop.org; dri-devel@lists.freedesktop.org
Subject: Re: [PATCH 1/2] drm/ttm: remove unused placement flags

In this case please just add them back in your tree. That should be a two liner.

For upstream it certainly doesn't make sense to keep them.

Regards,
Christian.

Am 09.09.2016 um 09:01 schrieb Flora Cui:
> yes. please don't do this, I need them.

>

> On Fri, Sep 09, 2016 at 02:41:16PM +0800, zhoucm1 wrote:

>>

>> On 2016年09月08日 21:41, Christian König wrote:

>>> From: Christian König <christian.koenig@amd.com>

>>>

>>> Either never used or not used in quite a while.

>> No, I remember Flora's Direct GMA is using them like GDS use PRIV0-2. 

>> And you cannot make sure there isn't no one using them in other 

>> closed projects, right?

>> If you removed now, that obviously will break her implementation and 

>> brings her many troubles.

>>

>>

>> Regards,

>> David Zhou

>>> Signed-off-by: Christian König <christian.koenig@amd.com>

>>> ---

>>>   drivers/gpu/drm/ttm/ttm_bo.c    |  2 +-

>>>   include/drm/ttm/ttm_placement.h | 19 -------------------

>>>   2 files changed, 1 insertion(+), 20 deletions(-)

>>>

>>> diff --git a/drivers/gpu/drm/ttm/ttm_bo.c 

>>> b/drivers/gpu/drm/ttm/ttm_bo.c index bc37f02..4d2e8f2 100644

>>> --- a/drivers/gpu/drm/ttm/ttm_bo.c

>>> +++ b/drivers/gpu/drm/ttm/ttm_bo.c

>>> @@ -59,7 +59,7 @@ static inline int ttm_mem_type_from_place(const struct ttm_place *place,

>>>   {

>>>   	int i;

>>> -	for (i = 0; i <= TTM_PL_PRIV5; i++)

>>> +	for (i = 0; i <= TTM_PL_PRIV2; i++)

>>>   		if (place->flags & (1 << i)) {

>>>   			*mem_type = i;

>>>   			return 0;

>>> diff --git a/include/drm/ttm/ttm_placement.h 

>>> b/include/drm/ttm/ttm_placement.h index 8ed44f9..20219d9 100644

>>> --- a/include/drm/ttm/ttm_placement.h

>>> +++ b/include/drm/ttm/ttm_placement.h

>>> @@ -40,10 +40,6 @@

>>>   #define TTM_PL_PRIV0            3

>>>   #define TTM_PL_PRIV1            4

>>>   #define TTM_PL_PRIV2            5

>>> -#define TTM_PL_PRIV3            6

>>> -#define TTM_PL_PRIV4            7

>>> -#define TTM_PL_PRIV5            8

>>> -#define TTM_PL_SWAPPED          15

>>>   #define TTM_PL_FLAG_SYSTEM      (1 << TTM_PL_SYSTEM)

>>>   #define TTM_PL_FLAG_TT          (1 << TTM_PL_TT)

>>> @@ -51,10 +47,6 @@

>>>   #define TTM_PL_FLAG_PRIV0       (1 << TTM_PL_PRIV0)

>>>   #define TTM_PL_FLAG_PRIV1       (1 << TTM_PL_PRIV1)

>>>   #define TTM_PL_FLAG_PRIV2       (1 << TTM_PL_PRIV2)

>>> -#define TTM_PL_FLAG_PRIV3       (1 << TTM_PL_PRIV3)

>>> -#define TTM_PL_FLAG_PRIV4       (1 << TTM_PL_PRIV4)

>>> -#define TTM_PL_FLAG_PRIV5       (1 << TTM_PL_PRIV5)

>>> -#define TTM_PL_FLAG_SWAPPED     (1 << TTM_PL_SWAPPED)

>>>   #define TTM_PL_MASK_MEM         0x0000FFFF

>>>   /*

>>> @@ -72,7 +64,6 @@

>>>   #define TTM_PL_FLAG_CACHED      (1 << 16)

>>>   #define TTM_PL_FLAG_UNCACHED    (1 << 17)

>>>   #define TTM_PL_FLAG_WC          (1 << 18)

>>> -#define TTM_PL_FLAG_SHARED      (1 << 20)

>>>   #define TTM_PL_FLAG_NO_EVICT    (1 << 21)

>>>   #define TTM_PL_FLAG_TOPDOWN     (1 << 22)

>>> @@ -82,14 +73,4 @@

>>>   #define TTM_PL_MASK_MEMTYPE     (TTM_PL_MASK_MEM | TTM_PL_MASK_CACHING)

>>> -/*

>>> - * Access flags to be used for CPU- and GPU- mappings.

>>> - * The idea is that the TTM synchronization mechanism will

>>> - * allow concurrent READ access and exclusive write access.

>>> - * Currently GPU- and CPU accesses are exclusive.

>>> - */

>>> -

>>> -#define TTM_ACCESS_READ         (1 << 0)

>>> -#define TTM_ACCESS_WRITE        (1 << 1)

>>> -

>>>   #endif

>> _______________________________________________

>> amd-gfx mailing list

>> amd-gfx@lists.freedesktop.org

>> https://lists.freedesktop.org/mailman/listinfo/amd-gfx



_______________________________________________
amd-gfx mailing list
amd-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
Zhang, Hawking Sept. 9, 2016, 10:35 a.m. UTC | #5
Hi Chris,

Removing the flag will make ttm_mem_type_from_place skip counting the corresponding placement and thus have impact on mem region create and bo movement. There is no guarantee that amdgpu would never introduce new memory domain in future. In such case, I'd like to vote for keeping these flags instead of adding them back when amdgpu need to add new memory domain.

As you mentioned that it just a two liner. And there is actually no functionality break with these flags. Then how about keep these flags?

Regards,
Hawking

-----Original Message-----
From: amd-gfx [mailto:amd-gfx-bounces@lists.freedesktop.org] On Behalf Of Christian K?nig

Sent: Friday, September 09, 2016 17:07
To: Cui, Flora <Flora.Cui@amd.com>; Zhou, David(ChunMing) <David1.Zhou@amd.com>
Cc: amd-gfx@lists.freedesktop.org; dri-devel@lists.freedesktop.org
Subject: Re: [PATCH 1/2] drm/ttm: remove unused placement flags

In this case please just add them back in your tree. That should be a two liner.

For upstream it certainly doesn't make sense to keep them.

Regards,
Christian.

Am 09.09.2016 um 09:01 schrieb Flora Cui:
> yes. please don't do this, I need them.

>

> On Fri, Sep 09, 2016 at 02:41:16PM +0800, zhoucm1 wrote:

>>

>> On 2016年09月08日 21:41, Christian König wrote:

>>> From: Christian König <christian.koenig@amd.com>

>>>

>>> Either never used or not used in quite a while.

>> No, I remember Flora's Direct GMA is using them like GDS use PRIV0-2. 

>> And you cannot make sure there isn't no one using them in other 

>> closed projects, right?

>> If you removed now, that obviously will break her implementation and 

>> brings her many troubles.

>>

>>

>> Regards,

>> David Zhou

>>> Signed-off-by: Christian König <christian.koenig@amd.com>

>>> ---

>>>   drivers/gpu/drm/ttm/ttm_bo.c    |  2 +-

>>>   include/drm/ttm/ttm_placement.h | 19 -------------------

>>>   2 files changed, 1 insertion(+), 20 deletions(-)

>>>

>>> diff --git a/drivers/gpu/drm/ttm/ttm_bo.c 

>>> b/drivers/gpu/drm/ttm/ttm_bo.c index bc37f02..4d2e8f2 100644

>>> --- a/drivers/gpu/drm/ttm/ttm_bo.c

>>> +++ b/drivers/gpu/drm/ttm/ttm_bo.c

>>> @@ -59,7 +59,7 @@ static inline int ttm_mem_type_from_place(const struct ttm_place *place,

>>>   {

>>>   	int i;

>>> -	for (i = 0; i <= TTM_PL_PRIV5; i++)

>>> +	for (i = 0; i <= TTM_PL_PRIV2; i++)

>>>   		if (place->flags & (1 << i)) {

>>>   			*mem_type = i;

>>>   			return 0;

>>> diff --git a/include/drm/ttm/ttm_placement.h 

>>> b/include/drm/ttm/ttm_placement.h index 8ed44f9..20219d9 100644

>>> --- a/include/drm/ttm/ttm_placement.h

>>> +++ b/include/drm/ttm/ttm_placement.h

>>> @@ -40,10 +40,6 @@

>>>   #define TTM_PL_PRIV0            3

>>>   #define TTM_PL_PRIV1            4

>>>   #define TTM_PL_PRIV2            5

>>> -#define TTM_PL_PRIV3            6

>>> -#define TTM_PL_PRIV4            7

>>> -#define TTM_PL_PRIV5            8

>>> -#define TTM_PL_SWAPPED          15

>>>   #define TTM_PL_FLAG_SYSTEM      (1 << TTM_PL_SYSTEM)

>>>   #define TTM_PL_FLAG_TT          (1 << TTM_PL_TT)

>>> @@ -51,10 +47,6 @@

>>>   #define TTM_PL_FLAG_PRIV0       (1 << TTM_PL_PRIV0)

>>>   #define TTM_PL_FLAG_PRIV1       (1 << TTM_PL_PRIV1)

>>>   #define TTM_PL_FLAG_PRIV2       (1 << TTM_PL_PRIV2)

>>> -#define TTM_PL_FLAG_PRIV3       (1 << TTM_PL_PRIV3)

>>> -#define TTM_PL_FLAG_PRIV4       (1 << TTM_PL_PRIV4)

>>> -#define TTM_PL_FLAG_PRIV5       (1 << TTM_PL_PRIV5)

>>> -#define TTM_PL_FLAG_SWAPPED     (1 << TTM_PL_SWAPPED)

>>>   #define TTM_PL_MASK_MEM         0x0000FFFF

>>>   /*

>>> @@ -72,7 +64,6 @@

>>>   #define TTM_PL_FLAG_CACHED      (1 << 16)

>>>   #define TTM_PL_FLAG_UNCACHED    (1 << 17)

>>>   #define TTM_PL_FLAG_WC          (1 << 18)

>>> -#define TTM_PL_FLAG_SHARED      (1 << 20)

>>>   #define TTM_PL_FLAG_NO_EVICT    (1 << 21)

>>>   #define TTM_PL_FLAG_TOPDOWN     (1 << 22)

>>> @@ -82,14 +73,4 @@

>>>   #define TTM_PL_MASK_MEMTYPE     (TTM_PL_MASK_MEM | TTM_PL_MASK_CACHING)

>>> -/*

>>> - * Access flags to be used for CPU- and GPU- mappings.

>>> - * The idea is that the TTM synchronization mechanism will

>>> - * allow concurrent READ access and exclusive write access.

>>> - * Currently GPU- and CPU accesses are exclusive.

>>> - */

>>> -

>>> -#define TTM_ACCESS_READ         (1 << 0)

>>> -#define TTM_ACCESS_WRITE        (1 << 1)

>>> -

>>>   #endif

>> _______________________________________________

>> amd-gfx mailing list

>> amd-gfx@lists.freedesktop.org

>> https://lists.freedesktop.org/mailman/listinfo/amd-gfx



_______________________________________________
amd-gfx mailing list
amd-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
Christian König Sept. 9, 2016, 11:24 a.m. UTC | #6
Hi Hawking,

> Removing the flag will make ttm_mem_type_from_place skip counting the corresponding placement and thus have impact on mem region create and bo movement.
And that is exactly the reason why I want to remove the unused flags.

> There is no guarantee that amdgpu would never introduce new memory domain in future.
Irrelevant, if any driver wants to use additional domains it should add 
them when they are used.

BTW: Why would we want to add another TTM domain? I really don't see any 
need for that.

> Then how about keep these flags?
Actually we used to have automated scanners which complain about unused 
code. I'm wondering why they don't detected that earlier.

Anyway any code which isn't used in a while should be removed.

Regards,
Christian.

Am 09.09.2016 um 12:35 schrieb Zhang, Hawking:
> Hi Chris,
>
> Removing the flag will make ttm_mem_type_from_place skip counting the corresponding placement and thus have impact on mem region create and bo movement. There is no guarantee that amdgpu would never introduce new memory domain in future. In such case, I'd like to vote for keeping these flags instead of adding them back when amdgpu need to add new memory domain.
>
> As you mentioned that it just a two liner. And there is actually no functionality break with these flags. Then how about keep these flags?
>
> Regards,
> Hawking
>
> -----Original Message-----
> From: amd-gfx [mailto:amd-gfx-bounces@lists.freedesktop.org] On Behalf Of Christian K?nig
> Sent: Friday, September 09, 2016 17:07
> To: Cui, Flora <Flora.Cui@amd.com>; Zhou, David(ChunMing) <David1.Zhou@amd.com>
> Cc: amd-gfx@lists.freedesktop.org; dri-devel@lists.freedesktop.org
> Subject: Re: [PATCH 1/2] drm/ttm: remove unused placement flags
>
> In this case please just add them back in your tree. That should be a two liner.
>
> For upstream it certainly doesn't make sense to keep them.
>
> Regards,
> Christian.
>
> Am 09.09.2016 um 09:01 schrieb Flora Cui:
>> yes. please don't do this, I need them.
>>
>> On Fri, Sep 09, 2016 at 02:41:16PM +0800, zhoucm1 wrote:
>>> On 2016年09月08日 21:41, Christian König wrote:
>>>> From: Christian König <christian.koenig@amd.com>
>>>>
>>>> Either never used or not used in quite a while.
>>> No, I remember Flora's Direct GMA is using them like GDS use PRIV0-2.
>>> And you cannot make sure there isn't no one using them in other
>>> closed projects, right?
>>> If you removed now, that obviously will break her implementation and
>>> brings her many troubles.
>>>
>>>
>>> Regards,
>>> David Zhou
>>>> Signed-off-by: Christian König <christian.koenig@amd.com>
>>>> ---
>>>>    drivers/gpu/drm/ttm/ttm_bo.c    |  2 +-
>>>>    include/drm/ttm/ttm_placement.h | 19 -------------------
>>>>    2 files changed, 1 insertion(+), 20 deletions(-)
>>>>
>>>> diff --git a/drivers/gpu/drm/ttm/ttm_bo.c
>>>> b/drivers/gpu/drm/ttm/ttm_bo.c index bc37f02..4d2e8f2 100644
>>>> --- a/drivers/gpu/drm/ttm/ttm_bo.c
>>>> +++ b/drivers/gpu/drm/ttm/ttm_bo.c
>>>> @@ -59,7 +59,7 @@ static inline int ttm_mem_type_from_place(const struct ttm_place *place,
>>>>    {
>>>>    	int i;
>>>> -	for (i = 0; i <= TTM_PL_PRIV5; i++)
>>>> +	for (i = 0; i <= TTM_PL_PRIV2; i++)
>>>>    		if (place->flags & (1 << i)) {
>>>>    			*mem_type = i;
>>>>    			return 0;
>>>> diff --git a/include/drm/ttm/ttm_placement.h
>>>> b/include/drm/ttm/ttm_placement.h index 8ed44f9..20219d9 100644
>>>> --- a/include/drm/ttm/ttm_placement.h
>>>> +++ b/include/drm/ttm/ttm_placement.h
>>>> @@ -40,10 +40,6 @@
>>>>    #define TTM_PL_PRIV0            3
>>>>    #define TTM_PL_PRIV1            4
>>>>    #define TTM_PL_PRIV2            5
>>>> -#define TTM_PL_PRIV3            6
>>>> -#define TTM_PL_PRIV4            7
>>>> -#define TTM_PL_PRIV5            8
>>>> -#define TTM_PL_SWAPPED          15
>>>>    #define TTM_PL_FLAG_SYSTEM      (1 << TTM_PL_SYSTEM)
>>>>    #define TTM_PL_FLAG_TT          (1 << TTM_PL_TT)
>>>> @@ -51,10 +47,6 @@
>>>>    #define TTM_PL_FLAG_PRIV0       (1 << TTM_PL_PRIV0)
>>>>    #define TTM_PL_FLAG_PRIV1       (1 << TTM_PL_PRIV1)
>>>>    #define TTM_PL_FLAG_PRIV2       (1 << TTM_PL_PRIV2)
>>>> -#define TTM_PL_FLAG_PRIV3       (1 << TTM_PL_PRIV3)
>>>> -#define TTM_PL_FLAG_PRIV4       (1 << TTM_PL_PRIV4)
>>>> -#define TTM_PL_FLAG_PRIV5       (1 << TTM_PL_PRIV5)
>>>> -#define TTM_PL_FLAG_SWAPPED     (1 << TTM_PL_SWAPPED)
>>>>    #define TTM_PL_MASK_MEM         0x0000FFFF
>>>>    /*
>>>> @@ -72,7 +64,6 @@
>>>>    #define TTM_PL_FLAG_CACHED      (1 << 16)
>>>>    #define TTM_PL_FLAG_UNCACHED    (1 << 17)
>>>>    #define TTM_PL_FLAG_WC          (1 << 18)
>>>> -#define TTM_PL_FLAG_SHARED      (1 << 20)
>>>>    #define TTM_PL_FLAG_NO_EVICT    (1 << 21)
>>>>    #define TTM_PL_FLAG_TOPDOWN     (1 << 22)
>>>> @@ -82,14 +73,4 @@
>>>>    #define TTM_PL_MASK_MEMTYPE     (TTM_PL_MASK_MEM | TTM_PL_MASK_CACHING)
>>>> -/*
>>>> - * Access flags to be used for CPU- and GPU- mappings.
>>>> - * The idea is that the TTM synchronization mechanism will
>>>> - * allow concurrent READ access and exclusive write access.
>>>> - * Currently GPU- and CPU accesses are exclusive.
>>>> - */
>>>> -
>>>> -#define TTM_ACCESS_READ         (1 << 0)
>>>> -#define TTM_ACCESS_WRITE        (1 << 1)
>>>> -
>>>>    #endif
>>> _______________________________________________
>>> amd-gfx mailing list
>>> amd-gfx@lists.freedesktop.org
>>> https://lists.freedesktop.org/mailman/listinfo/amd-gfx
>
> _______________________________________________
> amd-gfx mailing list
> amd-gfx@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/amd-gfx
> _______________________________________________
> amd-gfx mailing list
> amd-gfx@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/amd-gfx
Alex Deucher Sept. 9, 2016, 1:41 p.m. UTC | #7
> -----Original Message-----

> From: amd-gfx [mailto:amd-gfx-bounces@lists.freedesktop.org] On Behalf

> Of Christian König

> Sent: Friday, September 09, 2016 7:24 AM

> To: Zhang, Hawking; Koenig, Christian; Cui, Flora; Zhou, David(ChunMing);

> amd-gfx@lists.freedesktop.org

> Cc: dri-devel@lists.freedesktop.org

> Subject: Re: [PATCH 1/2] drm/ttm: remove unused placement flags

> 

> Hi Hawking,

> 

> > Removing the flag will make ttm_mem_type_from_place skip counting the

> corresponding placement and thus have impact on mem region create and

> bo movement.

> And that is exactly the reason why I want to remove the unused flags.

> 

> > There is no guarantee that amdgpu would never introduce new memory

> domain in future.

> Irrelevant, if any driver wants to use additional domains it should add

> them when they are used.

> 

> BTW: Why would we want to add another TTM domain? I really don't see any

> need for that.


We need it for the hybrid driver in the near feature and the open driver may use it in the future depending on the use cases.  Removing it just makes our lives more difficult for supporting dkms and distro integration for very minimal gain.

Alex

> 

> > Then how about keep these flags?

> Actually we used to have automated scanners which complain about unused

> code. I'm wondering why they don't detected that earlier.

> 

> Anyway any code which isn't used in a while should be removed.

> 

> Regards,

> Christian.

> 

> Am 09.09.2016 um 12:35 schrieb Zhang, Hawking:

> > Hi Chris,

> >

> > Removing the flag will make ttm_mem_type_from_place skip counting the

> corresponding placement and thus have impact on mem region create and

> bo movement. There is no guarantee that amdgpu would never introduce

> new memory domain in future. In such case, I'd like to vote for keeping

> these flags instead of adding them back when amdgpu need to add new

> memory domain.

> >

> > As you mentioned that it just a two liner. And there is actually no

> functionality break with these flags. Then how about keep these flags?

> >

> > Regards,

> > Hawking

> >

> > -----Original Message-----

> > From: amd-gfx [mailto:amd-gfx-bounces@lists.freedesktop.org] On Behalf

> Of Christian K?nig

> > Sent: Friday, September 09, 2016 17:07

> > To: Cui, Flora <Flora.Cui@amd.com>; Zhou, David(ChunMing)

> <David1.Zhou@amd.com>

> > Cc: amd-gfx@lists.freedesktop.org; dri-devel@lists.freedesktop.org

> > Subject: Re: [PATCH 1/2] drm/ttm: remove unused placement flags

> >

> > In this case please just add them back in your tree. That should be a two

> liner.

> >

> > For upstream it certainly doesn't make sense to keep them.

> >

> > Regards,

> > Christian.

> >

> > Am 09.09.2016 um 09:01 schrieb Flora Cui:

> >> yes. please don't do this, I need them.

> >>

> >> On Fri, Sep 09, 2016 at 02:41:16PM +0800, zhoucm1 wrote:

> >>> On 2016年09月08日 21:41, Christian König wrote:

> >>>> From: Christian König <christian.koenig@amd.com>

> >>>>

> >>>> Either never used or not used in quite a while.

> >>> No, I remember Flora's Direct GMA is using them like GDS use PRIV0-2.

> >>> And you cannot make sure there isn't no one using them in other

> >>> closed projects, right?

> >>> If you removed now, that obviously will break her implementation and

> >>> brings her many troubles.

> >>>

> >>>

> >>> Regards,

> >>> David Zhou

> >>>> Signed-off-by: Christian König <christian.koenig@amd.com>

> >>>> ---

> >>>>    drivers/gpu/drm/ttm/ttm_bo.c    |  2 +-

> >>>>    include/drm/ttm/ttm_placement.h | 19 -------------------

> >>>>    2 files changed, 1 insertion(+), 20 deletions(-)

> >>>>

> >>>> diff --git a/drivers/gpu/drm/ttm/ttm_bo.c

> >>>> b/drivers/gpu/drm/ttm/ttm_bo.c index bc37f02..4d2e8f2 100644

> >>>> --- a/drivers/gpu/drm/ttm/ttm_bo.c

> >>>> +++ b/drivers/gpu/drm/ttm/ttm_bo.c

> >>>> @@ -59,7 +59,7 @@ static inline int ttm_mem_type_from_place(const

> struct ttm_place *place,

> >>>>    {

> >>>>    	int i;

> >>>> -	for (i = 0; i <= TTM_PL_PRIV5; i++)

> >>>> +	for (i = 0; i <= TTM_PL_PRIV2; i++)

> >>>>    		if (place->flags & (1 << i)) {

> >>>>    			*mem_type = i;

> >>>>    			return 0;

> >>>> diff --git a/include/drm/ttm/ttm_placement.h

> >>>> b/include/drm/ttm/ttm_placement.h index 8ed44f9..20219d9 100644

> >>>> --- a/include/drm/ttm/ttm_placement.h

> >>>> +++ b/include/drm/ttm/ttm_placement.h

> >>>> @@ -40,10 +40,6 @@

> >>>>    #define TTM_PL_PRIV0            3

> >>>>    #define TTM_PL_PRIV1            4

> >>>>    #define TTM_PL_PRIV2            5

> >>>> -#define TTM_PL_PRIV3            6

> >>>> -#define TTM_PL_PRIV4            7

> >>>> -#define TTM_PL_PRIV5            8

> >>>> -#define TTM_PL_SWAPPED          15

> >>>>    #define TTM_PL_FLAG_SYSTEM      (1 << TTM_PL_SYSTEM)

> >>>>    #define TTM_PL_FLAG_TT          (1 << TTM_PL_TT)

> >>>> @@ -51,10 +47,6 @@

> >>>>    #define TTM_PL_FLAG_PRIV0       (1 << TTM_PL_PRIV0)

> >>>>    #define TTM_PL_FLAG_PRIV1       (1 << TTM_PL_PRIV1)

> >>>>    #define TTM_PL_FLAG_PRIV2       (1 << TTM_PL_PRIV2)

> >>>> -#define TTM_PL_FLAG_PRIV3       (1 << TTM_PL_PRIV3)

> >>>> -#define TTM_PL_FLAG_PRIV4       (1 << TTM_PL_PRIV4)

> >>>> -#define TTM_PL_FLAG_PRIV5       (1 << TTM_PL_PRIV5)

> >>>> -#define TTM_PL_FLAG_SWAPPED     (1 << TTM_PL_SWAPPED)

> >>>>    #define TTM_PL_MASK_MEM         0x0000FFFF

> >>>>    /*

> >>>> @@ -72,7 +64,6 @@

> >>>>    #define TTM_PL_FLAG_CACHED      (1 << 16)

> >>>>    #define TTM_PL_FLAG_UNCACHED    (1 << 17)

> >>>>    #define TTM_PL_FLAG_WC          (1 << 18)

> >>>> -#define TTM_PL_FLAG_SHARED      (1 << 20)

> >>>>    #define TTM_PL_FLAG_NO_EVICT    (1 << 21)

> >>>>    #define TTM_PL_FLAG_TOPDOWN     (1 << 22)

> >>>> @@ -82,14 +73,4 @@

> >>>>    #define TTM_PL_MASK_MEMTYPE     (TTM_PL_MASK_MEM |

> TTM_PL_MASK_CACHING)

> >>>> -/*

> >>>> - * Access flags to be used for CPU- and GPU- mappings.

> >>>> - * The idea is that the TTM synchronization mechanism will

> >>>> - * allow concurrent READ access and exclusive write access.

> >>>> - * Currently GPU- and CPU accesses are exclusive.

> >>>> - */

> >>>> -

> >>>> -#define TTM_ACCESS_READ         (1 << 0)

> >>>> -#define TTM_ACCESS_WRITE        (1 << 1)

> >>>> -

> >>>>    #endif

> >>> _______________________________________________

> >>> amd-gfx mailing list

> >>> amd-gfx@lists.freedesktop.org

> >>> https://lists.freedesktop.org/mailman/listinfo/amd-gfx

> >

> > _______________________________________________

> > amd-gfx mailing list

> > amd-gfx@lists.freedesktop.org

> > https://lists.freedesktop.org/mailman/listinfo/amd-gfx

> > _______________________________________________

> > amd-gfx mailing list

> > amd-gfx@lists.freedesktop.org

> > https://lists.freedesktop.org/mailman/listinfo/amd-gfx

> 

> 

> _______________________________________________

> amd-gfx mailing list

> amd-gfx@lists.freedesktop.org

> https://lists.freedesktop.org/mailman/listinfo/amd-gfx
Emil Velikov Sept. 9, 2016, 1:54 p.m. UTC | #8
On 9 September 2016 at 12:24, Christian König <deathsimple@vodafone.de> wrote:
> Hi Hawking,
>
>> Removing the flag will make ttm_mem_type_from_place skip counting the
>> corresponding placement and thus have impact on mem region create and bo
>> movement.
>
> And that is exactly the reason why I want to remove the unused flags.
>
>> There is no guarantee that amdgpu would never introduce new memory domain
>> in future.
>
> Irrelevant, if any driver wants to use additional domains it should add them
> when they are used.
>
> BTW: Why would we want to add another TTM domain? I really don't see any
> need for that.
>
>> Then how about keep these flags?
>
> Actually we used to have automated scanners which complain about unused
> code. I'm wondering why they don't detected that earlier.
>
> Anyway any code which isn't used in a while should be removed.
>
Fwiw I second Christian here. If they are unused in open-source
drivers there's no reason to keep them.
If/as that changes the (newly introduced) user can add back the relevant code.

If closed-source driver(s) use them, then they can keep it as part of
their blob. Upstream kernel does not cater for closed-source drivers,
period.
I realise that's not the answer some are hoping for, so if you want to
question it take it up with Linus and co.

Regards,
Emil
Christian König Sept. 9, 2016, 2:17 p.m. UTC | #9
Am 09.09.2016 um 15:41 schrieb Deucher, Alexander:
>> -----Original Message-----
>> From: amd-gfx [mailto:amd-gfx-bounces@lists.freedesktop.org] On Behalf
>> Of Christian König
>> Sent: Friday, September 09, 2016 7:24 AM
>> To: Zhang, Hawking; Koenig, Christian; Cui, Flora; Zhou, David(ChunMing);
>> amd-gfx@lists.freedesktop.org
>> Cc: dri-devel@lists.freedesktop.org
>> Subject: Re: [PATCH 1/2] drm/ttm: remove unused placement flags
>>
>> Hi Hawking,
>>
>>> Removing the flag will make ttm_mem_type_from_place skip counting the
>> corresponding placement and thus have impact on mem region create and
>> bo movement.
>> And that is exactly the reason why I want to remove the unused flags.
>>
>>> There is no guarantee that amdgpu would never introduce new memory
>> domain in future.
>> Irrelevant, if any driver wants to use additional domains it should add
>> them when they are used.
>>
>> BTW: Why would we want to add another TTM domain? I really don't see any
>> need for that.
> We need it for the hybrid driver in the near feature and the open driver may use it in the future depending on the use cases.  Removing it just makes our lives more difficult for supporting dkms and distro integration for very minimal gain.

Yeah, agree. The problem is I already did so without knowing that.

I will send out a V2 only removing the stuff we explicitly don't need.

Hopefully nobody will notice and question further,
Christian.

>
> Alex
>
>>> Then how about keep these flags?
>> Actually we used to have automated scanners which complain about unused
>> code. I'm wondering why they don't detected that earlier.
>>
>> Anyway any code which isn't used in a while should be removed.
>>
>> Regards,
>> Christian.
>>
>> Am 09.09.2016 um 12:35 schrieb Zhang, Hawking:
>>> Hi Chris,
>>>
>>> Removing the flag will make ttm_mem_type_from_place skip counting the
>> corresponding placement and thus have impact on mem region create and
>> bo movement. There is no guarantee that amdgpu would never introduce
>> new memory domain in future. In such case, I'd like to vote for keeping
>> these flags instead of adding them back when amdgpu need to add new
>> memory domain.
>>> As you mentioned that it just a two liner. And there is actually no
>> functionality break with these flags. Then how about keep these flags?
>>> Regards,
>>> Hawking
>>>
>>> -----Original Message-----
>>> From: amd-gfx [mailto:amd-gfx-bounces@lists.freedesktop.org] On Behalf
>> Of Christian K?nig
>>> Sent: Friday, September 09, 2016 17:07
>>> To: Cui, Flora <Flora.Cui@amd.com>; Zhou, David(ChunMing)
>> <David1.Zhou@amd.com>
>>> Cc: amd-gfx@lists.freedesktop.org; dri-devel@lists.freedesktop.org
>>> Subject: Re: [PATCH 1/2] drm/ttm: remove unused placement flags
>>>
>>> In this case please just add them back in your tree. That should be a two
>> liner.
>>> For upstream it certainly doesn't make sense to keep them.
>>>
>>> Regards,
>>> Christian.
>>>
>>> Am 09.09.2016 um 09:01 schrieb Flora Cui:
>>>> yes. please don't do this, I need them.
>>>>
>>>> On Fri, Sep 09, 2016 at 02:41:16PM +0800, zhoucm1 wrote:
>>>>> On 2016年09月08日 21:41, Christian König wrote:
>>>>>> From: Christian König <christian.koenig@amd.com>
>>>>>>
>>>>>> Either never used or not used in quite a while.
>>>>> No, I remember Flora's Direct GMA is using them like GDS use PRIV0-2.
>>>>> And you cannot make sure there isn't no one using them in other
>>>>> closed projects, right?
>>>>> If you removed now, that obviously will break her implementation and
>>>>> brings her many troubles.
>>>>>
>>>>>
>>>>> Regards,
>>>>> David Zhou
>>>>>> Signed-off-by: Christian König <christian.koenig@amd.com>
>>>>>> ---
>>>>>>     drivers/gpu/drm/ttm/ttm_bo.c    |  2 +-
>>>>>>     include/drm/ttm/ttm_placement.h | 19 -------------------
>>>>>>     2 files changed, 1 insertion(+), 20 deletions(-)
>>>>>>
>>>>>> diff --git a/drivers/gpu/drm/ttm/ttm_bo.c
>>>>>> b/drivers/gpu/drm/ttm/ttm_bo.c index bc37f02..4d2e8f2 100644
>>>>>> --- a/drivers/gpu/drm/ttm/ttm_bo.c
>>>>>> +++ b/drivers/gpu/drm/ttm/ttm_bo.c
>>>>>> @@ -59,7 +59,7 @@ static inline int ttm_mem_type_from_place(const
>> struct ttm_place *place,
>>>>>>     {
>>>>>>     	int i;
>>>>>> -	for (i = 0; i <= TTM_PL_PRIV5; i++)
>>>>>> +	for (i = 0; i <= TTM_PL_PRIV2; i++)
>>>>>>     		if (place->flags & (1 << i)) {
>>>>>>     			*mem_type = i;
>>>>>>     			return 0;
>>>>>> diff --git a/include/drm/ttm/ttm_placement.h
>>>>>> b/include/drm/ttm/ttm_placement.h index 8ed44f9..20219d9 100644
>>>>>> --- a/include/drm/ttm/ttm_placement.h
>>>>>> +++ b/include/drm/ttm/ttm_placement.h
>>>>>> @@ -40,10 +40,6 @@
>>>>>>     #define TTM_PL_PRIV0            3
>>>>>>     #define TTM_PL_PRIV1            4
>>>>>>     #define TTM_PL_PRIV2            5
>>>>>> -#define TTM_PL_PRIV3            6
>>>>>> -#define TTM_PL_PRIV4            7
>>>>>> -#define TTM_PL_PRIV5            8
>>>>>> -#define TTM_PL_SWAPPED          15
>>>>>>     #define TTM_PL_FLAG_SYSTEM      (1 << TTM_PL_SYSTEM)
>>>>>>     #define TTM_PL_FLAG_TT          (1 << TTM_PL_TT)
>>>>>> @@ -51,10 +47,6 @@
>>>>>>     #define TTM_PL_FLAG_PRIV0       (1 << TTM_PL_PRIV0)
>>>>>>     #define TTM_PL_FLAG_PRIV1       (1 << TTM_PL_PRIV1)
>>>>>>     #define TTM_PL_FLAG_PRIV2       (1 << TTM_PL_PRIV2)
>>>>>> -#define TTM_PL_FLAG_PRIV3       (1 << TTM_PL_PRIV3)
>>>>>> -#define TTM_PL_FLAG_PRIV4       (1 << TTM_PL_PRIV4)
>>>>>> -#define TTM_PL_FLAG_PRIV5       (1 << TTM_PL_PRIV5)
>>>>>> -#define TTM_PL_FLAG_SWAPPED     (1 << TTM_PL_SWAPPED)
>>>>>>     #define TTM_PL_MASK_MEM         0x0000FFFF
>>>>>>     /*
>>>>>> @@ -72,7 +64,6 @@
>>>>>>     #define TTM_PL_FLAG_CACHED      (1 << 16)
>>>>>>     #define TTM_PL_FLAG_UNCACHED    (1 << 17)
>>>>>>     #define TTM_PL_FLAG_WC          (1 << 18)
>>>>>> -#define TTM_PL_FLAG_SHARED      (1 << 20)
>>>>>>     #define TTM_PL_FLAG_NO_EVICT    (1 << 21)
>>>>>>     #define TTM_PL_FLAG_TOPDOWN     (1 << 22)
>>>>>> @@ -82,14 +73,4 @@
>>>>>>     #define TTM_PL_MASK_MEMTYPE     (TTM_PL_MASK_MEM |
>> TTM_PL_MASK_CACHING)
>>>>>> -/*
>>>>>> - * Access flags to be used for CPU- and GPU- mappings.
>>>>>> - * The idea is that the TTM synchronization mechanism will
>>>>>> - * allow concurrent READ access and exclusive write access.
>>>>>> - * Currently GPU- and CPU accesses are exclusive.
>>>>>> - */
>>>>>> -
>>>>>> -#define TTM_ACCESS_READ         (1 << 0)
>>>>>> -#define TTM_ACCESS_WRITE        (1 << 1)
>>>>>> -
>>>>>>     #endif
>>>>> _______________________________________________
>>>>> amd-gfx mailing list
>>>>> amd-gfx@lists.freedesktop.org
>>>>> https://lists.freedesktop.org/mailman/listinfo/amd-gfx
>>> _______________________________________________
>>> amd-gfx mailing list
>>> amd-gfx@lists.freedesktop.org
>>> https://lists.freedesktop.org/mailman/listinfo/amd-gfx
>>> _______________________________________________
>>> amd-gfx mailing list
>>> amd-gfx@lists.freedesktop.org
>>> https://lists.freedesktop.org/mailman/listinfo/amd-gfx
>>
>> _______________________________________________
>> amd-gfx mailing list
>> amd-gfx@lists.freedesktop.org
>> https://lists.freedesktop.org/mailman/listinfo/amd-gfx
Christian König Sept. 9, 2016, 2:30 p.m. UTC | #10
Am 09.09.2016 um 15:54 schrieb Emil Velikov:
> On 9 September 2016 at 12:24, Christian König <deathsimple@vodafone.de> wrote:
>> Hi Hawking,
>>
>>> Removing the flag will make ttm_mem_type_from_place skip counting the
>>> corresponding placement and thus have impact on mem region create and bo
>>> movement.
>> And that is exactly the reason why I want to remove the unused flags.
>>
>>> There is no guarantee that amdgpu would never introduce new memory domain
>>> in future.
>> Irrelevant, if any driver wants to use additional domains it should add them
>> when they are used.
>>
>> BTW: Why would we want to add another TTM domain? I really don't see any
>> need for that.
>>
>>> Then how about keep these flags?
>> Actually we used to have automated scanners which complain about unused
>> code. I'm wondering why they don't detected that earlier.
>>
>> Anyway any code which isn't used in a while should be removed.
>>
> Fwiw I second Christian here. If they are unused in open-source
> drivers there's no reason to keep them.
> If/as that changes the (newly introduced) user can add back the relevant code.

Crap to late :( I was about to send a V2 of the patch to keep the PRIV 
flags.

> If closed-source driver(s) use them, then they can keep it as part of
> their blob. Upstream kernel does not cater for closed-source drivers,
> period.
> I realise that's not the answer some are hoping for, so if you want to
> question it take it up with Linus and co.

It's not an issue between closed vs. open, but rather additional work of 
rebasing the open code when we start to use additional domains.

But on the other hand I still haven't seen a good reason for using 
those. As far as I know we have covered all resource in the current and 
next hardware generation with the existing flags.

Regards,
Christian.

> Regards,
> Emil
Emil Velikov Sept. 9, 2016, 3:11 p.m. UTC | #11
On 9 September 2016 at 15:30, Christian König <deathsimple@vodafone.de> wrote:
> Am 09.09.2016 um 15:54 schrieb Emil Velikov:
>>
>> On 9 September 2016 at 12:24, Christian König <deathsimple@vodafone.de>
>> wrote:
>>>
>>> Hi Hawking,
>>>
>>>> Removing the flag will make ttm_mem_type_from_place skip counting the
>>>> corresponding placement and thus have impact on mem region create and bo
>>>> movement.
>>>
>>> And that is exactly the reason why I want to remove the unused flags.
>>>
>>>> There is no guarantee that amdgpu would never introduce new memory
>>>> domain
>>>> in future.
>>>
>>> Irrelevant, if any driver wants to use additional domains it should add
>>> them
>>> when they are used.
>>>
>>> BTW: Why would we want to add another TTM domain? I really don't see any
>>> need for that.
>>>
>>>> Then how about keep these flags?
>>>
>>> Actually we used to have automated scanners which complain about unused
>>> code. I'm wondering why they don't detected that earlier.
>>>
>>> Anyway any code which isn't used in a while should be removed.
>>>
>> Fwiw I second Christian here. If they are unused in open-source
>> drivers there's no reason to keep them.
>> If/as that changes the (newly introduced) user can add back the relevant
>> code.
>
>
> Crap to late :( I was about to send a V2 of the patch to keep the PRIV
> flags.
>
Oops, sorry :-)

>> If closed-source driver(s) use them, then they can keep it as part of
>> their blob. Upstream kernel does not cater for closed-source drivers,
>> period.
>> I realise that's not the answer some are hoping for, so if you want to
>> question it take it up with Linus and co.
>
>
> It's not an issue between closed vs. open, but rather additional work of
> rebasing the open code when we start to use additional domains.
>
This should serve as a greater initiative to develop and upstream
things in a gradual manner, no ?
We all get carried away sometimes creating a massive branch which just
cannot go in at once.

> But on the other hand I still haven't seen a good reason for using those. As
> far as I know we have covered all resource in the current and next hardware
> generation with the existing flags.
>
This in itself is a pretty good point as well, considering you know
the hardware fairly well and you've worked in the kernel for quite a
while now.

Regards,
Emil
diff mbox

Patch

diff --git a/drivers/gpu/drm/ttm/ttm_bo.c b/drivers/gpu/drm/ttm/ttm_bo.c
index bc37f02..4d2e8f2 100644
--- a/drivers/gpu/drm/ttm/ttm_bo.c
+++ b/drivers/gpu/drm/ttm/ttm_bo.c
@@ -59,7 +59,7 @@  static inline int ttm_mem_type_from_place(const struct ttm_place *place,
 {
 	int i;
 
-	for (i = 0; i <= TTM_PL_PRIV5; i++)
+	for (i = 0; i <= TTM_PL_PRIV2; i++)
 		if (place->flags & (1 << i)) {
 			*mem_type = i;
 			return 0;
diff --git a/include/drm/ttm/ttm_placement.h b/include/drm/ttm/ttm_placement.h
index 8ed44f9..20219d9 100644
--- a/include/drm/ttm/ttm_placement.h
+++ b/include/drm/ttm/ttm_placement.h
@@ -40,10 +40,6 @@ 
 #define TTM_PL_PRIV0            3
 #define TTM_PL_PRIV1            4
 #define TTM_PL_PRIV2            5
-#define TTM_PL_PRIV3            6
-#define TTM_PL_PRIV4            7
-#define TTM_PL_PRIV5            8
-#define TTM_PL_SWAPPED          15
 
 #define TTM_PL_FLAG_SYSTEM      (1 << TTM_PL_SYSTEM)
 #define TTM_PL_FLAG_TT          (1 << TTM_PL_TT)
@@ -51,10 +47,6 @@ 
 #define TTM_PL_FLAG_PRIV0       (1 << TTM_PL_PRIV0)
 #define TTM_PL_FLAG_PRIV1       (1 << TTM_PL_PRIV1)
 #define TTM_PL_FLAG_PRIV2       (1 << TTM_PL_PRIV2)
-#define TTM_PL_FLAG_PRIV3       (1 << TTM_PL_PRIV3)
-#define TTM_PL_FLAG_PRIV4       (1 << TTM_PL_PRIV4)
-#define TTM_PL_FLAG_PRIV5       (1 << TTM_PL_PRIV5)
-#define TTM_PL_FLAG_SWAPPED     (1 << TTM_PL_SWAPPED)
 #define TTM_PL_MASK_MEM         0x0000FFFF
 
 /*
@@ -72,7 +64,6 @@ 
 #define TTM_PL_FLAG_CACHED      (1 << 16)
 #define TTM_PL_FLAG_UNCACHED    (1 << 17)
 #define TTM_PL_FLAG_WC          (1 << 18)
-#define TTM_PL_FLAG_SHARED      (1 << 20)
 #define TTM_PL_FLAG_NO_EVICT    (1 << 21)
 #define TTM_PL_FLAG_TOPDOWN     (1 << 22)
 
@@ -82,14 +73,4 @@ 
 
 #define TTM_PL_MASK_MEMTYPE     (TTM_PL_MASK_MEM | TTM_PL_MASK_CACHING)
 
-/*
- * Access flags to be used for CPU- and GPU- mappings.
- * The idea is that the TTM synchronization mechanism will
- * allow concurrent READ access and exclusive write access.
- * Currently GPU- and CPU accesses are exclusive.
- */
-
-#define TTM_ACCESS_READ         (1 << 0)
-#define TTM_ACCESS_WRITE        (1 << 1)
-
 #endif