diff mbox series

[1/3] Revert "drm/amdgpu: move internal vram_mgr function into the C file"

Message ID 20220708093047.492662-1-Arunpravin.PaneerSelvam@amd.com (mailing list archive)
State New, archived
Headers show
Series [1/3] Revert "drm/amdgpu: move internal vram_mgr function into the C file" | expand

Commit Message

Paneer Selvam, Arunpravin July 8, 2022, 9:30 a.m. UTC
This reverts commit 708d19d9f362766147cab79eccae60912c6d3068.

This is part of a revert of the following commits:
commit 708d19d9f362 ("drm/amdgpu: move internal vram_mgr function into the C file")
commit 5e3f1e7729ec ("drm/amdgpu: fix start calculation in amdgpu_vram_mgr_new")
commit c9cad937c0c5 ("drm/amdgpu: add drm buddy support to amdgpu")

[WHY]
Few users reported garbaged graphics as soon as x starts,
reverting until this can be resolved.

Signed-off-by: Arunpravin Paneer Selvam <Arunpravin.PaneerSelvam@amd.com>
---
 drivers/gpu/drm/amd/amdgpu/amdgpu_vram_mgr.c | 29 --------------------
 drivers/gpu/drm/amd/amdgpu/amdgpu_vram_mgr.h | 27 ++++++++++++++++++
 2 files changed, 27 insertions(+), 29 deletions(-)

Comments

Christian König July 8, 2022, 9:33 a.m. UTC | #1
Am 08.07.22 um 11:30 schrieb Arunpravin Paneer Selvam:
> This reverts commit 708d19d9f362766147cab79eccae60912c6d3068.
>
> This is part of a revert of the following commits:
> commit 708d19d9f362 ("drm/amdgpu: move internal vram_mgr function into the C file")
> commit 5e3f1e7729ec ("drm/amdgpu: fix start calculation in amdgpu_vram_mgr_new")
> commit c9cad937c0c5 ("drm/amdgpu: add drm buddy support to amdgpu")
>
> [WHY]
> Few users reported garbaged graphics as soon as x starts,
> reverting until this can be resolved.

Please squash all three patches into a single one. Apart from that looks 
good to me.

Christian.

>
> Signed-off-by: Arunpravin Paneer Selvam <Arunpravin.PaneerSelvam@amd.com>
> ---
>   drivers/gpu/drm/amd/amdgpu/amdgpu_vram_mgr.c | 29 --------------------
>   drivers/gpu/drm/amd/amdgpu/amdgpu_vram_mgr.h | 27 ++++++++++++++++++
>   2 files changed, 27 insertions(+), 29 deletions(-)
>
> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_vram_mgr.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_vram_mgr.c
> index 7a5e8a7b4a1b..51d9d3a4456c 100644
> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_vram_mgr.c
> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_vram_mgr.c
> @@ -50,35 +50,6 @@ to_amdgpu_device(struct amdgpu_vram_mgr *mgr)
>   	return container_of(mgr, struct amdgpu_device, mman.vram_mgr);
>   }
>   
> -static inline struct drm_buddy_block *
> -amdgpu_vram_mgr_first_block(struct list_head *list)
> -{
> -	return list_first_entry_or_null(list, struct drm_buddy_block, link);
> -}
> -
> -static inline bool amdgpu_is_vram_mgr_blocks_contiguous(struct list_head *head)
> -{
> -	struct drm_buddy_block *block;
> -	u64 start, size;
> -
> -	block = amdgpu_vram_mgr_first_block(head);
> -	if (!block)
> -		return false;
> -
> -	while (head != block->link.next) {
> -		start = amdgpu_vram_mgr_block_start(block);
> -		size = amdgpu_vram_mgr_block_size(block);
> -
> -		block = list_entry(block->link.next, struct drm_buddy_block, link);
> -		if (start + size != amdgpu_vram_mgr_block_start(block))
> -			return false;
> -	}
> -
> -	return true;
> -}
> -
> -
> -
>   /**
>    * DOC: mem_info_vram_total
>    *
> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_vram_mgr.h b/drivers/gpu/drm/amd/amdgpu/amdgpu_vram_mgr.h
> index 4b267bf1c5db..9a2db87186c7 100644
> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_vram_mgr.h
> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_vram_mgr.h
> @@ -53,6 +53,33 @@ static inline u64 amdgpu_vram_mgr_block_size(struct drm_buddy_block *block)
>   	return PAGE_SIZE << drm_buddy_block_order(block);
>   }
>   
> +static inline struct drm_buddy_block *
> +amdgpu_vram_mgr_first_block(struct list_head *list)
> +{
> +	return list_first_entry_or_null(list, struct drm_buddy_block, link);
> +}
> +
> +static inline bool amdgpu_is_vram_mgr_blocks_contiguous(struct list_head *head)
> +{
> +	struct drm_buddy_block *block;
> +	u64 start, size;
> +
> +	block = amdgpu_vram_mgr_first_block(head);
> +	if (!block)
> +		return false;
> +
> +	while (head != block->link.next) {
> +		start = amdgpu_vram_mgr_block_start(block);
> +		size = amdgpu_vram_mgr_block_size(block);
> +
> +		block = list_entry(block->link.next, struct drm_buddy_block, link);
> +		if (start + size != amdgpu_vram_mgr_block_start(block))
> +			return false;
> +	}
> +
> +	return true;
> +}
> +
>   static inline struct amdgpu_vram_mgr_resource *
>   to_amdgpu_vram_mgr_resource(struct ttm_resource *res)
>   {
Paneer Selvam, Arunpravin July 8, 2022, 10:23 a.m. UTC | #2
On 7/8/2022 3:03 PM, Christian König wrote:
> Am 08.07.22 um 11:30 schrieb Arunpravin Paneer Selvam:
>> This reverts commit 708d19d9f362766147cab79eccae60912c6d3068.
>>
>> This is part of a revert of the following commits:
>> commit 708d19d9f362 ("drm/amdgpu: move internal vram_mgr function 
>> into the C file")
>> commit 5e3f1e7729ec ("drm/amdgpu: fix start calculation in 
>> amdgpu_vram_mgr_new")
>> commit c9cad937c0c5 ("drm/amdgpu: add drm buddy support to amdgpu")
>>
>> [WHY]
>> Few users reported garbaged graphics as soon as x starts,
>> reverting until this can be resolved.
>
> Please squash all three patches into a single one. Apart from that 
> looks good to me.

I sent a new patch squashing all the three patches into a single one.

Thanks,
Arun
>
> Christian.
>
>>
>> Signed-off-by: Arunpravin Paneer Selvam 
>> <Arunpravin.PaneerSelvam@amd.com>
>> ---
>>   drivers/gpu/drm/amd/amdgpu/amdgpu_vram_mgr.c | 29 --------------------
>>   drivers/gpu/drm/amd/amdgpu/amdgpu_vram_mgr.h | 27 ++++++++++++++++++
>>   2 files changed, 27 insertions(+), 29 deletions(-)
>>
>> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_vram_mgr.c 
>> b/drivers/gpu/drm/amd/amdgpu/amdgpu_vram_mgr.c
>> index 7a5e8a7b4a1b..51d9d3a4456c 100644
>> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_vram_mgr.c
>> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_vram_mgr.c
>> @@ -50,35 +50,6 @@ to_amdgpu_device(struct amdgpu_vram_mgr *mgr)
>>       return container_of(mgr, struct amdgpu_device, mman.vram_mgr);
>>   }
>>   -static inline struct drm_buddy_block *
>> -amdgpu_vram_mgr_first_block(struct list_head *list)
>> -{
>> -    return list_first_entry_or_null(list, struct drm_buddy_block, 
>> link);
>> -}
>> -
>> -static inline bool amdgpu_is_vram_mgr_blocks_contiguous(struct 
>> list_head *head)
>> -{
>> -    struct drm_buddy_block *block;
>> -    u64 start, size;
>> -
>> -    block = amdgpu_vram_mgr_first_block(head);
>> -    if (!block)
>> -        return false;
>> -
>> -    while (head != block->link.next) {
>> -        start = amdgpu_vram_mgr_block_start(block);
>> -        size = amdgpu_vram_mgr_block_size(block);
>> -
>> -        block = list_entry(block->link.next, struct drm_buddy_block, 
>> link);
>> -        if (start + size != amdgpu_vram_mgr_block_start(block))
>> -            return false;
>> -    }
>> -
>> -    return true;
>> -}
>> -
>> -
>> -
>>   /**
>>    * DOC: mem_info_vram_total
>>    *
>> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_vram_mgr.h 
>> b/drivers/gpu/drm/amd/amdgpu/amdgpu_vram_mgr.h
>> index 4b267bf1c5db..9a2db87186c7 100644
>> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_vram_mgr.h
>> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_vram_mgr.h
>> @@ -53,6 +53,33 @@ static inline u64 
>> amdgpu_vram_mgr_block_size(struct drm_buddy_block *block)
>>       return PAGE_SIZE << drm_buddy_block_order(block);
>>   }
>>   +static inline struct drm_buddy_block *
>> +amdgpu_vram_mgr_first_block(struct list_head *list)
>> +{
>> +    return list_first_entry_or_null(list, struct drm_buddy_block, 
>> link);
>> +}
>> +
>> +static inline bool amdgpu_is_vram_mgr_blocks_contiguous(struct 
>> list_head *head)
>> +{
>> +    struct drm_buddy_block *block;
>> +    u64 start, size;
>> +
>> +    block = amdgpu_vram_mgr_first_block(head);
>> +    if (!block)
>> +        return false;
>> +
>> +    while (head != block->link.next) {
>> +        start = amdgpu_vram_mgr_block_start(block);
>> +        size = amdgpu_vram_mgr_block_size(block);
>> +
>> +        block = list_entry(block->link.next, struct drm_buddy_block, 
>> link);
>> +        if (start + size != amdgpu_vram_mgr_block_start(block))
>> +            return false;
>> +    }
>> +
>> +    return true;
>> +}
>> +
>>   static inline struct amdgpu_vram_mgr_resource *
>>   to_amdgpu_vram_mgr_resource(struct ttm_resource *res)
>>   {
>
Thomas Zimmermann July 14, 2022, 8:45 a.m. UTC | #3
Hi

Am 08.07.22 um 11:30 schrieb Arunpravin Paneer Selvam:
> This reverts commit 708d19d9f362766147cab79eccae60912c6d3068.

This commit is only present in drm-misc-next. Should the revert be 
cherry-picked into drm-misc-next-fixes?

Best regards
Thomas

> 
> This is part of a revert of the following commits:
> commit 708d19d9f362 ("drm/amdgpu: move internal vram_mgr function into the C file")
> commit 5e3f1e7729ec ("drm/amdgpu: fix start calculation in amdgpu_vram_mgr_new")
> commit c9cad937c0c5 ("drm/amdgpu: add drm buddy support to amdgpu")
> 
> [WHY]
> Few users reported garbaged graphics as soon as x starts,
> reverting until this can be resolved.
> 
> Signed-off-by: Arunpravin Paneer Selvam <Arunpravin.PaneerSelvam@amd.com>
> ---
>   drivers/gpu/drm/amd/amdgpu/amdgpu_vram_mgr.c | 29 --------------------
>   drivers/gpu/drm/amd/amdgpu/amdgpu_vram_mgr.h | 27 ++++++++++++++++++
>   2 files changed, 27 insertions(+), 29 deletions(-)
> 
> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_vram_mgr.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_vram_mgr.c
> index 7a5e8a7b4a1b..51d9d3a4456c 100644
> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_vram_mgr.c
> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_vram_mgr.c
> @@ -50,35 +50,6 @@ to_amdgpu_device(struct amdgpu_vram_mgr *mgr)
>   	return container_of(mgr, struct amdgpu_device, mman.vram_mgr);
>   }
>   
> -static inline struct drm_buddy_block *
> -amdgpu_vram_mgr_first_block(struct list_head *list)
> -{
> -	return list_first_entry_or_null(list, struct drm_buddy_block, link);
> -}
> -
> -static inline bool amdgpu_is_vram_mgr_blocks_contiguous(struct list_head *head)
> -{
> -	struct drm_buddy_block *block;
> -	u64 start, size;
> -
> -	block = amdgpu_vram_mgr_first_block(head);
> -	if (!block)
> -		return false;
> -
> -	while (head != block->link.next) {
> -		start = amdgpu_vram_mgr_block_start(block);
> -		size = amdgpu_vram_mgr_block_size(block);
> -
> -		block = list_entry(block->link.next, struct drm_buddy_block, link);
> -		if (start + size != amdgpu_vram_mgr_block_start(block))
> -			return false;
> -	}
> -
> -	return true;
> -}
> -
> -
> -
>   /**
>    * DOC: mem_info_vram_total
>    *
> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_vram_mgr.h b/drivers/gpu/drm/amd/amdgpu/amdgpu_vram_mgr.h
> index 4b267bf1c5db..9a2db87186c7 100644
> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_vram_mgr.h
> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_vram_mgr.h
> @@ -53,6 +53,33 @@ static inline u64 amdgpu_vram_mgr_block_size(struct drm_buddy_block *block)
>   	return PAGE_SIZE << drm_buddy_block_order(block);
>   }
>   
> +static inline struct drm_buddy_block *
> +amdgpu_vram_mgr_first_block(struct list_head *list)
> +{
> +	return list_first_entry_or_null(list, struct drm_buddy_block, link);
> +}
> +
> +static inline bool amdgpu_is_vram_mgr_blocks_contiguous(struct list_head *head)
> +{
> +	struct drm_buddy_block *block;
> +	u64 start, size;
> +
> +	block = amdgpu_vram_mgr_first_block(head);
> +	if (!block)
> +		return false;
> +
> +	while (head != block->link.next) {
> +		start = amdgpu_vram_mgr_block_start(block);
> +		size = amdgpu_vram_mgr_block_size(block);
> +
> +		block = list_entry(block->link.next, struct drm_buddy_block, link);
> +		if (start + size != amdgpu_vram_mgr_block_start(block))
> +			return false;
> +	}
> +
> +	return true;
> +}
> +
>   static inline struct amdgpu_vram_mgr_resource *
>   to_amdgpu_vram_mgr_resource(struct ttm_resource *res)
>   {
Tvrtko Ursulin July 22, 2022, 2:46 p.m. UTC | #4
On 14/07/2022 09:45, Thomas Zimmermann wrote:
> Hi
> 
> Am 08.07.22 um 11:30 schrieb Arunpravin Paneer Selvam:
>> This reverts commit 708d19d9f362766147cab79eccae60912c6d3068.
> 
> This commit is only present in drm-misc-next. Should the revert be 
> cherry-picked into drm-misc-next-fixes?

Seemed like an appropriate thread to raise this, in case my pings about 
it on #dri-devel and #radeon go un-noticed since it is Friday after all.

So for me dri-tip today fails to build the amdgpu driver.

I had to revert 925b6e59138cefa47275c67891c65d48d3266d57 to make it 
build. This conflicts a bit but seems trivial. Without this revert code 
seems confused with different versions of struct amdgpu_vram_mgr and 
build fails violently (increase your scroll back buffers to see it all).

Regards,

Tvrtko

> Best regards
> Thomas
> 
>>
>> This is part of a revert of the following commits:
>> commit 708d19d9f362 ("drm/amdgpu: move internal vram_mgr function into 
>> the C file")
>> commit 5e3f1e7729ec ("drm/amdgpu: fix start calculation in 
>> amdgpu_vram_mgr_new")
>> commit c9cad937c0c5 ("drm/amdgpu: add drm buddy support to amdgpu")
>>
>> [WHY]
>> Few users reported garbaged graphics as soon as x starts,
>> reverting until this can be resolved.
>>
>> Signed-off-by: Arunpravin Paneer Selvam <Arunpravin.PaneerSelvam@amd.com>
>> ---
>>   drivers/gpu/drm/amd/amdgpu/amdgpu_vram_mgr.c | 29 --------------------
>>   drivers/gpu/drm/amd/amdgpu/amdgpu_vram_mgr.h | 27 ++++++++++++++++++
>>   2 files changed, 27 insertions(+), 29 deletions(-)
>>
>> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_vram_mgr.c 
>> b/drivers/gpu/drm/amd/amdgpu/amdgpu_vram_mgr.c
>> index 7a5e8a7b4a1b..51d9d3a4456c 100644
>> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_vram_mgr.c
>> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_vram_mgr.c
>> @@ -50,35 +50,6 @@ to_amdgpu_device(struct amdgpu_vram_mgr *mgr)
>>       return container_of(mgr, struct amdgpu_device, mman.vram_mgr);
>>   }
>> -static inline struct drm_buddy_block *
>> -amdgpu_vram_mgr_first_block(struct list_head *list)
>> -{
>> -    return list_first_entry_or_null(list, struct drm_buddy_block, link);
>> -}
>> -
>> -static inline bool amdgpu_is_vram_mgr_blocks_contiguous(struct 
>> list_head *head)
>> -{
>> -    struct drm_buddy_block *block;
>> -    u64 start, size;
>> -
>> -    block = amdgpu_vram_mgr_first_block(head);
>> -    if (!block)
>> -        return false;
>> -
>> -    while (head != block->link.next) {
>> -        start = amdgpu_vram_mgr_block_start(block);
>> -        size = amdgpu_vram_mgr_block_size(block);
>> -
>> -        block = list_entry(block->link.next, struct drm_buddy_block, 
>> link);
>> -        if (start + size != amdgpu_vram_mgr_block_start(block))
>> -            return false;
>> -    }
>> -
>> -    return true;
>> -}
>> -
>> -
>> -
>>   /**
>>    * DOC: mem_info_vram_total
>>    *
>> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_vram_mgr.h 
>> b/drivers/gpu/drm/amd/amdgpu/amdgpu_vram_mgr.h
>> index 4b267bf1c5db..9a2db87186c7 100644
>> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_vram_mgr.h
>> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_vram_mgr.h
>> @@ -53,6 +53,33 @@ static inline u64 amdgpu_vram_mgr_block_size(struct 
>> drm_buddy_block *block)
>>       return PAGE_SIZE << drm_buddy_block_order(block);
>>   }
>> +static inline struct drm_buddy_block *
>> +amdgpu_vram_mgr_first_block(struct list_head *list)
>> +{
>> +    return list_first_entry_or_null(list, struct drm_buddy_block, link);
>> +}
>> +
>> +static inline bool amdgpu_is_vram_mgr_blocks_contiguous(struct 
>> list_head *head)
>> +{
>> +    struct drm_buddy_block *block;
>> +    u64 start, size;
>> +
>> +    block = amdgpu_vram_mgr_first_block(head);
>> +    if (!block)
>> +        return false;
>> +
>> +    while (head != block->link.next) {
>> +        start = amdgpu_vram_mgr_block_start(block);
>> +        size = amdgpu_vram_mgr_block_size(block);
>> +
>> +        block = list_entry(block->link.next, struct drm_buddy_block, 
>> link);
>> +        if (start + size != amdgpu_vram_mgr_block_start(block))
>> +            return false;
>> +    }
>> +
>> +    return true;
>> +}
>> +
>>   static inline struct amdgpu_vram_mgr_resource *
>>   to_amdgpu_vram_mgr_resource(struct ttm_resource *res)
>>   {
>
Christian König July 22, 2022, 3:47 p.m. UTC | #5
Hi Tvrtko,

scratching my head what exactly is going on here.

I've build tested drm-tip a couple of test in the last week and it 
always worked flawlessly.

It looks like that some conflict resolution is sometimes not applied 
correctly, but I have no idea why.

Regards,
Christian.

Am 22.07.22 um 16:46 schrieb Tvrtko Ursulin:
>
> On 14/07/2022 09:45, Thomas Zimmermann wrote:
>> Hi
>>
>> Am 08.07.22 um 11:30 schrieb Arunpravin Paneer Selvam:
>>> This reverts commit 708d19d9f362766147cab79eccae60912c6d3068.
>>
>> This commit is only present in drm-misc-next. Should the revert be 
>> cherry-picked into drm-misc-next-fixes?
>
> Seemed like an appropriate thread to raise this, in case my pings 
> about it on #dri-devel and #radeon go un-noticed since it is Friday 
> after all.
>
> So for me dri-tip today fails to build the amdgpu driver.
>
> I had to revert 925b6e59138cefa47275c67891c65d48d3266d57 to make it 
> build. This conflicts a bit but seems trivial. Without this revert 
> code seems confused with different versions of struct amdgpu_vram_mgr 
> and build fails violently (increase your scroll back buffers to see it 
> all).
>
> Regards,
>
> Tvrtko
>
>> Best regards
>> Thomas
>>
>>>
>>> This is part of a revert of the following commits:
>>> commit 708d19d9f362 ("drm/amdgpu: move internal vram_mgr function 
>>> into the C file")
>>> commit 5e3f1e7729ec ("drm/amdgpu: fix start calculation in 
>>> amdgpu_vram_mgr_new")
>>> commit c9cad937c0c5 ("drm/amdgpu: add drm buddy support to amdgpu")
>>>
>>> [WHY]
>>> Few users reported garbaged graphics as soon as x starts,
>>> reverting until this can be resolved.
>>>
>>> Signed-off-by: Arunpravin Paneer Selvam 
>>> <Arunpravin.PaneerSelvam@amd.com>
>>> ---
>>>   drivers/gpu/drm/amd/amdgpu/amdgpu_vram_mgr.c | 29 
>>> --------------------
>>>   drivers/gpu/drm/amd/amdgpu/amdgpu_vram_mgr.h | 27 ++++++++++++++++++
>>>   2 files changed, 27 insertions(+), 29 deletions(-)
>>>
>>> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_vram_mgr.c 
>>> b/drivers/gpu/drm/amd/amdgpu/amdgpu_vram_mgr.c
>>> index 7a5e8a7b4a1b..51d9d3a4456c 100644
>>> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_vram_mgr.c
>>> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_vram_mgr.c
>>> @@ -50,35 +50,6 @@ to_amdgpu_device(struct amdgpu_vram_mgr *mgr)
>>>       return container_of(mgr, struct amdgpu_device, mman.vram_mgr);
>>>   }
>>> -static inline struct drm_buddy_block *
>>> -amdgpu_vram_mgr_first_block(struct list_head *list)
>>> -{
>>> -    return list_first_entry_or_null(list, struct drm_buddy_block, 
>>> link);
>>> -}
>>> -
>>> -static inline bool amdgpu_is_vram_mgr_blocks_contiguous(struct 
>>> list_head *head)
>>> -{
>>> -    struct drm_buddy_block *block;
>>> -    u64 start, size;
>>> -
>>> -    block = amdgpu_vram_mgr_first_block(head);
>>> -    if (!block)
>>> -        return false;
>>> -
>>> -    while (head != block->link.next) {
>>> -        start = amdgpu_vram_mgr_block_start(block);
>>> -        size = amdgpu_vram_mgr_block_size(block);
>>> -
>>> -        block = list_entry(block->link.next, struct 
>>> drm_buddy_block, link);
>>> -        if (start + size != amdgpu_vram_mgr_block_start(block))
>>> -            return false;
>>> -    }
>>> -
>>> -    return true;
>>> -}
>>> -
>>> -
>>> -
>>>   /**
>>>    * DOC: mem_info_vram_total
>>>    *
>>> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_vram_mgr.h 
>>> b/drivers/gpu/drm/amd/amdgpu/amdgpu_vram_mgr.h
>>> index 4b267bf1c5db..9a2db87186c7 100644
>>> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_vram_mgr.h
>>> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_vram_mgr.h
>>> @@ -53,6 +53,33 @@ static inline u64 
>>> amdgpu_vram_mgr_block_size(struct drm_buddy_block *block)
>>>       return PAGE_SIZE << drm_buddy_block_order(block);
>>>   }
>>> +static inline struct drm_buddy_block *
>>> +amdgpu_vram_mgr_first_block(struct list_head *list)
>>> +{
>>> +    return list_first_entry_or_null(list, struct drm_buddy_block, 
>>> link);
>>> +}
>>> +
>>> +static inline bool amdgpu_is_vram_mgr_blocks_contiguous(struct 
>>> list_head *head)
>>> +{
>>> +    struct drm_buddy_block *block;
>>> +    u64 start, size;
>>> +
>>> +    block = amdgpu_vram_mgr_first_block(head);
>>> +    if (!block)
>>> +        return false;
>>> +
>>> +    while (head != block->link.next) {
>>> +        start = amdgpu_vram_mgr_block_start(block);
>>> +        size = amdgpu_vram_mgr_block_size(block);
>>> +
>>> +        block = list_entry(block->link.next, struct 
>>> drm_buddy_block, link);
>>> +        if (start + size != amdgpu_vram_mgr_block_start(block))
>>> +            return false;
>>> +    }
>>> +
>>> +    return true;
>>> +}
>>> +
>>>   static inline struct amdgpu_vram_mgr_resource *
>>>   to_amdgpu_vram_mgr_resource(struct ttm_resource *res)
>>>   {
>>
Thomas Zimmermann July 24, 2022, 6:28 p.m. UTC | #6
Hi

Am 22.07.22 um 17:47 schrieb Christian König:
> Hi Tvrtko,
> 
> scratching my head what exactly is going on here.
> 
> I've build tested drm-tip a couple of test in the last week and it 
> always worked flawlessly.
> 
> It looks like that some conflict resolution is sometimes not applied 
> correctly, but I have no idea why.

It worked last week, but must have been reintroduced meanhwile.
Please fetch the latest drm-tip and rebuild. The attached config 
produces the error on my system.

Best regards
Thomas

> 
> Regards,
> Christian.
> 
> Am 22.07.22 um 16:46 schrieb Tvrtko Ursulin:
>>
>> On 14/07/2022 09:45, Thomas Zimmermann wrote:
>>> Hi
>>>
>>> Am 08.07.22 um 11:30 schrieb Arunpravin Paneer Selvam:
>>>> This reverts commit 708d19d9f362766147cab79eccae60912c6d3068.
>>>
>>> This commit is only present in drm-misc-next. Should the revert be 
>>> cherry-picked into drm-misc-next-fixes?
>>
>> Seemed like an appropriate thread to raise this, in case my pings 
>> about it on #dri-devel and #radeon go un-noticed since it is Friday 
>> after all.
>>
>> So for me dri-tip today fails to build the amdgpu driver.
>>
>> I had to revert 925b6e59138cefa47275c67891c65d48d3266d57 to make it 
>> build. This conflicts a bit but seems trivial. Without this revert 
>> code seems confused with different versions of struct amdgpu_vram_mgr 
>> and build fails violently (increase your scroll back buffers to see it 
>> all).
>>
>> Regards,
>>
>> Tvrtko
>>
>>> Best regards
>>> Thomas
>>>
>>>>
>>>> This is part of a revert of the following commits:
>>>> commit 708d19d9f362 ("drm/amdgpu: move internal vram_mgr function 
>>>> into the C file")
>>>> commit 5e3f1e7729ec ("drm/amdgpu: fix start calculation in 
>>>> amdgpu_vram_mgr_new")
>>>> commit c9cad937c0c5 ("drm/amdgpu: add drm buddy support to amdgpu")
>>>>
>>>> [WHY]
>>>> Few users reported garbaged graphics as soon as x starts,
>>>> reverting until this can be resolved.
>>>>
>>>> Signed-off-by: Arunpravin Paneer Selvam 
>>>> <Arunpravin.PaneerSelvam@amd.com>
>>>> ---
>>>>   drivers/gpu/drm/amd/amdgpu/amdgpu_vram_mgr.c | 29 
>>>> --------------------
>>>>   drivers/gpu/drm/amd/amdgpu/amdgpu_vram_mgr.h | 27 ++++++++++++++++++
>>>>   2 files changed, 27 insertions(+), 29 deletions(-)
>>>>
>>>> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_vram_mgr.c 
>>>> b/drivers/gpu/drm/amd/amdgpu/amdgpu_vram_mgr.c
>>>> index 7a5e8a7b4a1b..51d9d3a4456c 100644
>>>> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_vram_mgr.c
>>>> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_vram_mgr.c
>>>> @@ -50,35 +50,6 @@ to_amdgpu_device(struct amdgpu_vram_mgr *mgr)
>>>>       return container_of(mgr, struct amdgpu_device, mman.vram_mgr);
>>>>   }
>>>> -static inline struct drm_buddy_block *
>>>> -amdgpu_vram_mgr_first_block(struct list_head *list)
>>>> -{
>>>> -    return list_first_entry_or_null(list, struct drm_buddy_block, 
>>>> link);
>>>> -}
>>>> -
>>>> -static inline bool amdgpu_is_vram_mgr_blocks_contiguous(struct 
>>>> list_head *head)
>>>> -{
>>>> -    struct drm_buddy_block *block;
>>>> -    u64 start, size;
>>>> -
>>>> -    block = amdgpu_vram_mgr_first_block(head);
>>>> -    if (!block)
>>>> -        return false;
>>>> -
>>>> -    while (head != block->link.next) {
>>>> -        start = amdgpu_vram_mgr_block_start(block);
>>>> -        size = amdgpu_vram_mgr_block_size(block);
>>>> -
>>>> -        block = list_entry(block->link.next, struct 
>>>> drm_buddy_block, link);
>>>> -        if (start + size != amdgpu_vram_mgr_block_start(block))
>>>> -            return false;
>>>> -    }
>>>> -
>>>> -    return true;
>>>> -}
>>>> -
>>>> -
>>>> -
>>>>   /**
>>>>    * DOC: mem_info_vram_total
>>>>    *
>>>> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_vram_mgr.h 
>>>> b/drivers/gpu/drm/amd/amdgpu/amdgpu_vram_mgr.h
>>>> index 4b267bf1c5db..9a2db87186c7 100644
>>>> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_vram_mgr.h
>>>> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_vram_mgr.h
>>>> @@ -53,6 +53,33 @@ static inline u64 
>>>> amdgpu_vram_mgr_block_size(struct drm_buddy_block *block)
>>>>       return PAGE_SIZE << drm_buddy_block_order(block);
>>>>   }
>>>> +static inline struct drm_buddy_block *
>>>> +amdgpu_vram_mgr_first_block(struct list_head *list)
>>>> +{
>>>> +    return list_first_entry_or_null(list, struct drm_buddy_block, 
>>>> link);
>>>> +}
>>>> +
>>>> +static inline bool amdgpu_is_vram_mgr_blocks_contiguous(struct 
>>>> list_head *head)
>>>> +{
>>>> +    struct drm_buddy_block *block;
>>>> +    u64 start, size;
>>>> +
>>>> +    block = amdgpu_vram_mgr_first_block(head);
>>>> +    if (!block)
>>>> +        return false;
>>>> +
>>>> +    while (head != block->link.next) {
>>>> +        start = amdgpu_vram_mgr_block_start(block);
>>>> +        size = amdgpu_vram_mgr_block_size(block);
>>>> +
>>>> +        block = list_entry(block->link.next, struct 
>>>> drm_buddy_block, link);
>>>> +        if (start + size != amdgpu_vram_mgr_block_start(block))
>>>> +            return false;
>>>> +    }
>>>> +
>>>> +    return true;
>>>> +}
>>>> +
>>>>   static inline struct amdgpu_vram_mgr_resource *
>>>>   to_amdgpu_vram_mgr_resource(struct ttm_resource *res)
>>>>   {
>>>
>
Tvrtko Ursulin July 25, 2022, 3:27 p.m. UTC | #7
On 24/07/2022 19:28, Thomas Zimmermann wrote:
> Hi
> 
> Am 22.07.22 um 17:47 schrieb Christian König:
>> Hi Tvrtko,
>>
>> scratching my head what exactly is going on here.
>>
>> I've build tested drm-tip a couple of test in the last week and it 
>> always worked flawlessly.
>>
>> It looks like that some conflict resolution is sometimes not applied 
>> correctly, but I have no idea why.
> 
> It worked last week, but must have been reintroduced meanhwile.
> Please fetch the latest drm-tip and rebuild. The attached config 
> produces the error on my system.

What is the status with this? I hit a conflict on an implicated file 
just now trying to rebuild drm-tip:

Unmerged paths:
   (use "git add/rm <file>..." as appropriate to mark resolution)
         deleted by us:   drivers/gpu/drm/amd/amdgpu/amdgpu_vram_mgr.h

I had an other i915 conflict to solve and as grep amdgpu_vram_mgr.h 
drivers/gpu/drm/amd produced nothing I just did a git rm on it and 
pushed the resolution.

Let me know if I broke something, re-broke something, or whatever.. 
Build of amdgpu certainly still looks broken on my end, both before and 
after me rebuilding drm-tip so maybe I just preserved the breakage.

Regards,

Tvrtko

> 
> Best regards
> Thomas
> 
>>
>> Regards,
>> Christian.
>>
>> Am 22.07.22 um 16:46 schrieb Tvrtko Ursulin:
>>>
>>> On 14/07/2022 09:45, Thomas Zimmermann wrote:
>>>> Hi
>>>>
>>>> Am 08.07.22 um 11:30 schrieb Arunpravin Paneer Selvam:
>>>>> This reverts commit 708d19d9f362766147cab79eccae60912c6d3068.
>>>>
>>>> This commit is only present in drm-misc-next. Should the revert be 
>>>> cherry-picked into drm-misc-next-fixes?
>>>
>>> Seemed like an appropriate thread to raise this, in case my pings 
>>> about it on #dri-devel and #radeon go un-noticed since it is Friday 
>>> after all.
>>>
>>> So for me dri-tip today fails to build the amdgpu driver.
>>>
>>> I had to revert 925b6e59138cefa47275c67891c65d48d3266d57 to make it 
>>> build. This conflicts a bit but seems trivial. Without this revert 
>>> code seems confused with different versions of struct amdgpu_vram_mgr 
>>> and build fails violently (increase your scroll back buffers to see 
>>> it all).
>>>
>>> Regards,
>>>
>>> Tvrtko
>>>
>>>> Best regards
>>>> Thomas
>>>>
>>>>>
>>>>> This is part of a revert of the following commits:
>>>>> commit 708d19d9f362 ("drm/amdgpu: move internal vram_mgr function 
>>>>> into the C file")
>>>>> commit 5e3f1e7729ec ("drm/amdgpu: fix start calculation in 
>>>>> amdgpu_vram_mgr_new")
>>>>> commit c9cad937c0c5 ("drm/amdgpu: add drm buddy support to amdgpu")
>>>>>
>>>>> [WHY]
>>>>> Few users reported garbaged graphics as soon as x starts,
>>>>> reverting until this can be resolved.
>>>>>
>>>>> Signed-off-by: Arunpravin Paneer Selvam 
>>>>> <Arunpravin.PaneerSelvam@amd.com>
>>>>> ---
>>>>>   drivers/gpu/drm/amd/amdgpu/amdgpu_vram_mgr.c | 29 
>>>>> --------------------
>>>>>   drivers/gpu/drm/amd/amdgpu/amdgpu_vram_mgr.h | 27 ++++++++++++++++++
>>>>>   2 files changed, 27 insertions(+), 29 deletions(-)
>>>>>
>>>>> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_vram_mgr.c 
>>>>> b/drivers/gpu/drm/amd/amdgpu/amdgpu_vram_mgr.c
>>>>> index 7a5e8a7b4a1b..51d9d3a4456c 100644
>>>>> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_vram_mgr.c
>>>>> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_vram_mgr.c
>>>>> @@ -50,35 +50,6 @@ to_amdgpu_device(struct amdgpu_vram_mgr *mgr)
>>>>>       return container_of(mgr, struct amdgpu_device, mman.vram_mgr);
>>>>>   }
>>>>> -static inline struct drm_buddy_block *
>>>>> -amdgpu_vram_mgr_first_block(struct list_head *list)
>>>>> -{
>>>>> -    return list_first_entry_or_null(list, struct drm_buddy_block, 
>>>>> link);
>>>>> -}
>>>>> -
>>>>> -static inline bool amdgpu_is_vram_mgr_blocks_contiguous(struct 
>>>>> list_head *head)
>>>>> -{
>>>>> -    struct drm_buddy_block *block;
>>>>> -    u64 start, size;
>>>>> -
>>>>> -    block = amdgpu_vram_mgr_first_block(head);
>>>>> -    if (!block)
>>>>> -        return false;
>>>>> -
>>>>> -    while (head != block->link.next) {
>>>>> -        start = amdgpu_vram_mgr_block_start(block);
>>>>> -        size = amdgpu_vram_mgr_block_size(block);
>>>>> -
>>>>> -        block = list_entry(block->link.next, struct 
>>>>> drm_buddy_block, link);
>>>>> -        if (start + size != amdgpu_vram_mgr_block_start(block))
>>>>> -            return false;
>>>>> -    }
>>>>> -
>>>>> -    return true;
>>>>> -}
>>>>> -
>>>>> -
>>>>> -
>>>>>   /**
>>>>>    * DOC: mem_info_vram_total
>>>>>    *
>>>>> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_vram_mgr.h 
>>>>> b/drivers/gpu/drm/amd/amdgpu/amdgpu_vram_mgr.h
>>>>> index 4b267bf1c5db..9a2db87186c7 100644
>>>>> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_vram_mgr.h
>>>>> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_vram_mgr.h
>>>>> @@ -53,6 +53,33 @@ static inline u64 
>>>>> amdgpu_vram_mgr_block_size(struct drm_buddy_block *block)
>>>>>       return PAGE_SIZE << drm_buddy_block_order(block);
>>>>>   }
>>>>> +static inline struct drm_buddy_block *
>>>>> +amdgpu_vram_mgr_first_block(struct list_head *list)
>>>>> +{
>>>>> +    return list_first_entry_or_null(list, struct drm_buddy_block, 
>>>>> link);
>>>>> +}
>>>>> +
>>>>> +static inline bool amdgpu_is_vram_mgr_blocks_contiguous(struct 
>>>>> list_head *head)
>>>>> +{
>>>>> +    struct drm_buddy_block *block;
>>>>> +    u64 start, size;
>>>>> +
>>>>> +    block = amdgpu_vram_mgr_first_block(head);
>>>>> +    if (!block)
>>>>> +        return false;
>>>>> +
>>>>> +    while (head != block->link.next) {
>>>>> +        start = amdgpu_vram_mgr_block_start(block);
>>>>> +        size = amdgpu_vram_mgr_block_size(block);
>>>>> +
>>>>> +        block = list_entry(block->link.next, struct 
>>>>> drm_buddy_block, link);
>>>>> +        if (start + size != amdgpu_vram_mgr_block_start(block))
>>>>> +            return false;
>>>>> +    }
>>>>> +
>>>>> +    return true;
>>>>> +}
>>>>> +
>>>>>   static inline struct amdgpu_vram_mgr_resource *
>>>>>   to_amdgpu_vram_mgr_resource(struct ttm_resource *res)
>>>>>   {
>>>>
>>
>
Christian König July 25, 2022, 5:14 p.m. UTC | #8
Am 25.07.22 um 17:27 schrieb Tvrtko Ursulin:
>
> On 24/07/2022 19:28, Thomas Zimmermann wrote:
>> Hi
>>
>> Am 22.07.22 um 17:47 schrieb Christian König:
>>> Hi Tvrtko,
>>>
>>> scratching my head what exactly is going on here.
>>>
>>> I've build tested drm-tip a couple of test in the last week and it 
>>> always worked flawlessly.
>>>
>>> It looks like that some conflict resolution is sometimes not applied 
>>> correctly, but I have no idea why.
>>
>> It worked last week, but must have been reintroduced meanhwile.
>> Please fetch the latest drm-tip and rebuild. The attached config 
>> produces the error on my system.
>
> What is the status with this? I hit a conflict on an implicated file 
> just now trying to rebuild drm-tip:
>
> Unmerged paths:
>   (use "git add/rm <file>..." as appropriate to mark resolution)
>         deleted by us: drivers/gpu/drm/amd/amdgpu/amdgpu_vram_mgr.h
>
> I had an other i915 conflict to solve and as grep amdgpu_vram_mgr.h 
> drivers/gpu/drm/amd produced nothing I just did a git rm on it and 
> pushed the resolution.
>
> Let me know if I broke something, re-broke something, or whatever.. 
> Build of amdgpu certainly still looks broken on my end, both before 
> and after me rebuilding drm-tip so maybe I just preserved the breakage.

It looks like that somehow re-broke, but I'm not sure how.

I've fetched drm-tip on Friday at around 1pm CET and build it and that 
worked perfectly fine.

Essentially the status of drm-misc-next for the following files should 
be carried on in drm-tip:

drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.h
drivers/gpu/drm/amd/amdgpu/amdgpu_res_cursor.h
drivers/gpu/drm/amd/amdgpu/amdgpu_vram_mgr.c
drivers/gpu/drm/amd/amdgpu/amdgpu_vram_mgr.h

Regards,
Christian.

>
> Regards,
>
> Tvrtko
>
>>
>> Best regards
>> Thomas
>>
>>>
>>> Regards,
>>> Christian.
>>>
>>> Am 22.07.22 um 16:46 schrieb Tvrtko Ursulin:
>>>>
>>>> On 14/07/2022 09:45, Thomas Zimmermann wrote:
>>>>> Hi
>>>>>
>>>>> Am 08.07.22 um 11:30 schrieb Arunpravin Paneer Selvam:
>>>>>> This reverts commit 708d19d9f362766147cab79eccae60912c6d3068.
>>>>>
>>>>> This commit is only present in drm-misc-next. Should the revert be 
>>>>> cherry-picked into drm-misc-next-fixes?
>>>>
>>>> Seemed like an appropriate thread to raise this, in case my pings 
>>>> about it on #dri-devel and #radeon go un-noticed since it is Friday 
>>>> after all.
>>>>
>>>> So for me dri-tip today fails to build the amdgpu driver.
>>>>
>>>> I had to revert 925b6e59138cefa47275c67891c65d48d3266d57 to make it 
>>>> build. This conflicts a bit but seems trivial. Without this revert 
>>>> code seems confused with different versions of struct 
>>>> amdgpu_vram_mgr and build fails violently (increase your scroll 
>>>> back buffers to see it all).
>>>>
>>>> Regards,
>>>>
>>>> Tvrtko
>>>>
>>>>> Best regards
>>>>> Thomas
>>>>>
>>>>>>
>>>>>> This is part of a revert of the following commits:
>>>>>> commit 708d19d9f362 ("drm/amdgpu: move internal vram_mgr function 
>>>>>> into the C file")
>>>>>> commit 5e3f1e7729ec ("drm/amdgpu: fix start calculation in 
>>>>>> amdgpu_vram_mgr_new")
>>>>>> commit c9cad937c0c5 ("drm/amdgpu: add drm buddy support to amdgpu")
>>>>>>
>>>>>> [WHY]
>>>>>> Few users reported garbaged graphics as soon as x starts,
>>>>>> reverting until this can be resolved.
>>>>>>
>>>>>> Signed-off-by: Arunpravin Paneer Selvam 
>>>>>> <Arunpravin.PaneerSelvam@amd.com>
>>>>>> ---
>>>>>>   drivers/gpu/drm/amd/amdgpu/amdgpu_vram_mgr.c | 29 
>>>>>> --------------------
>>>>>>   drivers/gpu/drm/amd/amdgpu/amdgpu_vram_mgr.h | 27 
>>>>>> ++++++++++++++++++
>>>>>>   2 files changed, 27 insertions(+), 29 deletions(-)
>>>>>>
>>>>>> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_vram_mgr.c 
>>>>>> b/drivers/gpu/drm/amd/amdgpu/amdgpu_vram_mgr.c
>>>>>> index 7a5e8a7b4a1b..51d9d3a4456c 100644
>>>>>> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_vram_mgr.c
>>>>>> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_vram_mgr.c
>>>>>> @@ -50,35 +50,6 @@ to_amdgpu_device(struct amdgpu_vram_mgr *mgr)
>>>>>>       return container_of(mgr, struct amdgpu_device, mman.vram_mgr);
>>>>>>   }
>>>>>> -static inline struct drm_buddy_block *
>>>>>> -amdgpu_vram_mgr_first_block(struct list_head *list)
>>>>>> -{
>>>>>> -    return list_first_entry_or_null(list, struct 
>>>>>> drm_buddy_block, link);
>>>>>> -}
>>>>>> -
>>>>>> -static inline bool amdgpu_is_vram_mgr_blocks_contiguous(struct 
>>>>>> list_head *head)
>>>>>> -{
>>>>>> -    struct drm_buddy_block *block;
>>>>>> -    u64 start, size;
>>>>>> -
>>>>>> -    block = amdgpu_vram_mgr_first_block(head);
>>>>>> -    if (!block)
>>>>>> -        return false;
>>>>>> -
>>>>>> -    while (head != block->link.next) {
>>>>>> -        start = amdgpu_vram_mgr_block_start(block);
>>>>>> -        size = amdgpu_vram_mgr_block_size(block);
>>>>>> -
>>>>>> -        block = list_entry(block->link.next, struct 
>>>>>> drm_buddy_block, link);
>>>>>> -        if (start + size != amdgpu_vram_mgr_block_start(block))
>>>>>> -            return false;
>>>>>> -    }
>>>>>> -
>>>>>> -    return true;
>>>>>> -}
>>>>>> -
>>>>>> -
>>>>>> -
>>>>>>   /**
>>>>>>    * DOC: mem_info_vram_total
>>>>>>    *
>>>>>> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_vram_mgr.h 
>>>>>> b/drivers/gpu/drm/amd/amdgpu/amdgpu_vram_mgr.h
>>>>>> index 4b267bf1c5db..9a2db87186c7 100644
>>>>>> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_vram_mgr.h
>>>>>> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_vram_mgr.h
>>>>>> @@ -53,6 +53,33 @@ static inline u64 
>>>>>> amdgpu_vram_mgr_block_size(struct drm_buddy_block *block)
>>>>>>       return PAGE_SIZE << drm_buddy_block_order(block);
>>>>>>   }
>>>>>> +static inline struct drm_buddy_block *
>>>>>> +amdgpu_vram_mgr_first_block(struct list_head *list)
>>>>>> +{
>>>>>> +    return list_first_entry_or_null(list, struct 
>>>>>> drm_buddy_block, link);
>>>>>> +}
>>>>>> +
>>>>>> +static inline bool amdgpu_is_vram_mgr_blocks_contiguous(struct 
>>>>>> list_head *head)
>>>>>> +{
>>>>>> +    struct drm_buddy_block *block;
>>>>>> +    u64 start, size;
>>>>>> +
>>>>>> +    block = amdgpu_vram_mgr_first_block(head);
>>>>>> +    if (!block)
>>>>>> +        return false;
>>>>>> +
>>>>>> +    while (head != block->link.next) {
>>>>>> +        start = amdgpu_vram_mgr_block_start(block);
>>>>>> +        size = amdgpu_vram_mgr_block_size(block);
>>>>>> +
>>>>>> +        block = list_entry(block->link.next, struct 
>>>>>> drm_buddy_block, link);
>>>>>> +        if (start + size != amdgpu_vram_mgr_block_start(block))
>>>>>> +            return false;
>>>>>> +    }
>>>>>> +
>>>>>> +    return true;
>>>>>> +}
>>>>>> +
>>>>>>   static inline struct amdgpu_vram_mgr_resource *
>>>>>>   to_amdgpu_vram_mgr_resource(struct ttm_resource *res)
>>>>>>   {
>>>>>
>>>
>>
Thomas Zimmermann July 26, 2022, 7:46 a.m. UTC | #9
Hi

Am 25.07.22 um 19:14 schrieb Christian König:
> Am 25.07.22 um 17:27 schrieb Tvrtko Ursulin:
>>
>> On 24/07/2022 19:28, Thomas Zimmermann wrote:
>>> Hi
>>>
>>> Am 22.07.22 um 17:47 schrieb Christian König:
>>>> Hi Tvrtko,
>>>>
>>>> scratching my head what exactly is going on here.
>>>>
>>>> I've build tested drm-tip a couple of test in the last week and it 
>>>> always worked flawlessly.
>>>>
>>>> It looks like that some conflict resolution is sometimes not applied 
>>>> correctly, but I have no idea why.
>>>
>>> It worked last week, but must have been reintroduced meanhwile.
>>> Please fetch the latest drm-tip and rebuild. The attached config 
>>> produces the error on my system.
>>
>> What is the status with this? I hit a conflict on an implicated file 
>> just now trying to rebuild drm-tip:
>>
>> Unmerged paths:
>>   (use "git add/rm <file>..." as appropriate to mark resolution)
>>         deleted by us: drivers/gpu/drm/amd/amdgpu/amdgpu_vram_mgr.h
>>
>> I had an other i915 conflict to solve and as grep amdgpu_vram_mgr.h 
>> drivers/gpu/drm/amd produced nothing I just did a git rm on it and 
>> pushed the resolution.
>>
>> Let me know if I broke something, re-broke something, or whatever.. 
>> Build of amdgpu certainly still looks broken on my end, both before 
>> and after me rebuilding drm-tip so maybe I just preserved the breakage.
> 
> It looks like that somehow re-broke, but I'm not sure how.
> 
> I've fetched drm-tip on Friday at around 1pm CET and build it and that 
> worked perfectly fine.
> 
> Essentially the status of drm-misc-next for the following files should 
> be carried on in drm-tip:
> 
> drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.h
> drivers/gpu/drm/amd/amdgpu/amdgpu_res_cursor.h
> drivers/gpu/drm/amd/amdgpu/amdgpu_vram_mgr.c
> drivers/gpu/drm/amd/amdgpu/amdgpu_vram_mgr.h

I've reset these files to their state as in drm-misc-next and updated 
drm-tip. It appears to be working again from what I could test locally. 
Please try at your earliest convenience.

Best regards
Thomas

> 
> Regards,
> Christian.
> 
>>
>> Regards,
>>
>> Tvrtko
>>
>>>
>>> Best regards
>>> Thomas
>>>
>>>>
>>>> Regards,
>>>> Christian.
>>>>
>>>> Am 22.07.22 um 16:46 schrieb Tvrtko Ursulin:
>>>>>
>>>>> On 14/07/2022 09:45, Thomas Zimmermann wrote:
>>>>>> Hi
>>>>>>
>>>>>> Am 08.07.22 um 11:30 schrieb Arunpravin Paneer Selvam:
>>>>>>> This reverts commit 708d19d9f362766147cab79eccae60912c6d3068.
>>>>>>
>>>>>> This commit is only present in drm-misc-next. Should the revert be 
>>>>>> cherry-picked into drm-misc-next-fixes?
>>>>>
>>>>> Seemed like an appropriate thread to raise this, in case my pings 
>>>>> about it on #dri-devel and #radeon go un-noticed since it is Friday 
>>>>> after all.
>>>>>
>>>>> So for me dri-tip today fails to build the amdgpu driver.
>>>>>
>>>>> I had to revert 925b6e59138cefa47275c67891c65d48d3266d57 to make it 
>>>>> build. This conflicts a bit but seems trivial. Without this revert 
>>>>> code seems confused with different versions of struct 
>>>>> amdgpu_vram_mgr and build fails violently (increase your scroll 
>>>>> back buffers to see it all).
>>>>>
>>>>> Regards,
>>>>>
>>>>> Tvrtko
>>>>>
>>>>>> Best regards
>>>>>> Thomas
>>>>>>
>>>>>>>
>>>>>>> This is part of a revert of the following commits:
>>>>>>> commit 708d19d9f362 ("drm/amdgpu: move internal vram_mgr function 
>>>>>>> into the C file")
>>>>>>> commit 5e3f1e7729ec ("drm/amdgpu: fix start calculation in 
>>>>>>> amdgpu_vram_mgr_new")
>>>>>>> commit c9cad937c0c5 ("drm/amdgpu: add drm buddy support to amdgpu")
>>>>>>>
>>>>>>> [WHY]
>>>>>>> Few users reported garbaged graphics as soon as x starts,
>>>>>>> reverting until this can be resolved.
>>>>>>>
>>>>>>> Signed-off-by: Arunpravin Paneer Selvam 
>>>>>>> <Arunpravin.PaneerSelvam@amd.com>
>>>>>>> ---
>>>>>>>   drivers/gpu/drm/amd/amdgpu/amdgpu_vram_mgr.c | 29 
>>>>>>> --------------------
>>>>>>>   drivers/gpu/drm/amd/amdgpu/amdgpu_vram_mgr.h | 27 
>>>>>>> ++++++++++++++++++
>>>>>>>   2 files changed, 27 insertions(+), 29 deletions(-)
>>>>>>>
>>>>>>> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_vram_mgr.c 
>>>>>>> b/drivers/gpu/drm/amd/amdgpu/amdgpu_vram_mgr.c
>>>>>>> index 7a5e8a7b4a1b..51d9d3a4456c 100644
>>>>>>> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_vram_mgr.c
>>>>>>> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_vram_mgr.c
>>>>>>> @@ -50,35 +50,6 @@ to_amdgpu_device(struct amdgpu_vram_mgr *mgr)
>>>>>>>       return container_of(mgr, struct amdgpu_device, mman.vram_mgr);
>>>>>>>   }
>>>>>>> -static inline struct drm_buddy_block *
>>>>>>> -amdgpu_vram_mgr_first_block(struct list_head *list)
>>>>>>> -{
>>>>>>> -    return list_first_entry_or_null(list, struct 
>>>>>>> drm_buddy_block, link);
>>>>>>> -}
>>>>>>> -
>>>>>>> -static inline bool amdgpu_is_vram_mgr_blocks_contiguous(struct 
>>>>>>> list_head *head)
>>>>>>> -{
>>>>>>> -    struct drm_buddy_block *block;
>>>>>>> -    u64 start, size;
>>>>>>> -
>>>>>>> -    block = amdgpu_vram_mgr_first_block(head);
>>>>>>> -    if (!block)
>>>>>>> -        return false;
>>>>>>> -
>>>>>>> -    while (head != block->link.next) {
>>>>>>> -        start = amdgpu_vram_mgr_block_start(block);
>>>>>>> -        size = amdgpu_vram_mgr_block_size(block);
>>>>>>> -
>>>>>>> -        block = list_entry(block->link.next, struct 
>>>>>>> drm_buddy_block, link);
>>>>>>> -        if (start + size != amdgpu_vram_mgr_block_start(block))
>>>>>>> -            return false;
>>>>>>> -    }
>>>>>>> -
>>>>>>> -    return true;
>>>>>>> -}
>>>>>>> -
>>>>>>> -
>>>>>>> -
>>>>>>>   /**
>>>>>>>    * DOC: mem_info_vram_total
>>>>>>>    *
>>>>>>> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_vram_mgr.h 
>>>>>>> b/drivers/gpu/drm/amd/amdgpu/amdgpu_vram_mgr.h
>>>>>>> index 4b267bf1c5db..9a2db87186c7 100644
>>>>>>> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_vram_mgr.h
>>>>>>> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_vram_mgr.h
>>>>>>> @@ -53,6 +53,33 @@ static inline u64 
>>>>>>> amdgpu_vram_mgr_block_size(struct drm_buddy_block *block)
>>>>>>>       return PAGE_SIZE << drm_buddy_block_order(block);
>>>>>>>   }
>>>>>>> +static inline struct drm_buddy_block *
>>>>>>> +amdgpu_vram_mgr_first_block(struct list_head *list)
>>>>>>> +{
>>>>>>> +    return list_first_entry_or_null(list, struct 
>>>>>>> drm_buddy_block, link);
>>>>>>> +}
>>>>>>> +
>>>>>>> +static inline bool amdgpu_is_vram_mgr_blocks_contiguous(struct 
>>>>>>> list_head *head)
>>>>>>> +{
>>>>>>> +    struct drm_buddy_block *block;
>>>>>>> +    u64 start, size;
>>>>>>> +
>>>>>>> +    block = amdgpu_vram_mgr_first_block(head);
>>>>>>> +    if (!block)
>>>>>>> +        return false;
>>>>>>> +
>>>>>>> +    while (head != block->link.next) {
>>>>>>> +        start = amdgpu_vram_mgr_block_start(block);
>>>>>>> +        size = amdgpu_vram_mgr_block_size(block);
>>>>>>> +
>>>>>>> +        block = list_entry(block->link.next, struct 
>>>>>>> drm_buddy_block, link);
>>>>>>> +        if (start + size != amdgpu_vram_mgr_block_start(block))
>>>>>>> +            return false;
>>>>>>> +    }
>>>>>>> +
>>>>>>> +    return true;
>>>>>>> +}
>>>>>>> +
>>>>>>>   static inline struct amdgpu_vram_mgr_resource *
>>>>>>>   to_amdgpu_vram_mgr_resource(struct ttm_resource *res)
>>>>>>>   {
>>>>>>
>>>>
>>>
>
Tvrtko Ursulin July 26, 2022, 8:41 a.m. UTC | #10
On 26/07/2022 08:46, Thomas Zimmermann wrote:
> Hi
> 
> Am 25.07.22 um 19:14 schrieb Christian König:
>> Am 25.07.22 um 17:27 schrieb Tvrtko Ursulin:
>>>
>>> On 24/07/2022 19:28, Thomas Zimmermann wrote:
>>>> Hi
>>>>
>>>> Am 22.07.22 um 17:47 schrieb Christian König:
>>>>> Hi Tvrtko,
>>>>>
>>>>> scratching my head what exactly is going on here.
>>>>>
>>>>> I've build tested drm-tip a couple of test in the last week and it 
>>>>> always worked flawlessly.
>>>>>
>>>>> It looks like that some conflict resolution is sometimes not 
>>>>> applied correctly, but I have no idea why.
>>>>
>>>> It worked last week, but must have been reintroduced meanhwile.
>>>> Please fetch the latest drm-tip and rebuild. The attached config 
>>>> produces the error on my system.
>>>
>>> What is the status with this? I hit a conflict on an implicated file 
>>> just now trying to rebuild drm-tip:
>>>
>>> Unmerged paths:
>>>   (use "git add/rm <file>..." as appropriate to mark resolution)
>>>         deleted by us: drivers/gpu/drm/amd/amdgpu/amdgpu_vram_mgr.h
>>>
>>> I had an other i915 conflict to solve and as grep amdgpu_vram_mgr.h 
>>> drivers/gpu/drm/amd produced nothing I just did a git rm on it and 
>>> pushed the resolution.
>>>
>>> Let me know if I broke something, re-broke something, or whatever.. 
>>> Build of amdgpu certainly still looks broken on my end, both before 
>>> and after me rebuilding drm-tip so maybe I just preserved the breakage.
>>
>> It looks like that somehow re-broke, but I'm not sure how.
>>
>> I've fetched drm-tip on Friday at around 1pm CET and build it and that 
>> worked perfectly fine.
>>
>> Essentially the status of drm-misc-next for the following files should 
>> be carried on in drm-tip:
>>
>> drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.h
>> drivers/gpu/drm/amd/amdgpu/amdgpu_res_cursor.h
>> drivers/gpu/drm/amd/amdgpu/amdgpu_vram_mgr.c
>> drivers/gpu/drm/amd/amdgpu/amdgpu_vram_mgr.h
> 
> I've reset these files to their state as in drm-misc-next and updated 
> drm-tip. It appears to be working again from what I could test locally. 
> Please try at your earliest convenience.

Builds for me now - thank you!

Regards,

Tvrtko
diff mbox series

Patch

diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_vram_mgr.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_vram_mgr.c
index 7a5e8a7b4a1b..51d9d3a4456c 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_vram_mgr.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_vram_mgr.c
@@ -50,35 +50,6 @@  to_amdgpu_device(struct amdgpu_vram_mgr *mgr)
 	return container_of(mgr, struct amdgpu_device, mman.vram_mgr);
 }
 
-static inline struct drm_buddy_block *
-amdgpu_vram_mgr_first_block(struct list_head *list)
-{
-	return list_first_entry_or_null(list, struct drm_buddy_block, link);
-}
-
-static inline bool amdgpu_is_vram_mgr_blocks_contiguous(struct list_head *head)
-{
-	struct drm_buddy_block *block;
-	u64 start, size;
-
-	block = amdgpu_vram_mgr_first_block(head);
-	if (!block)
-		return false;
-
-	while (head != block->link.next) {
-		start = amdgpu_vram_mgr_block_start(block);
-		size = amdgpu_vram_mgr_block_size(block);
-
-		block = list_entry(block->link.next, struct drm_buddy_block, link);
-		if (start + size != amdgpu_vram_mgr_block_start(block))
-			return false;
-	}
-
-	return true;
-}
-
-
-
 /**
  * DOC: mem_info_vram_total
  *
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_vram_mgr.h b/drivers/gpu/drm/amd/amdgpu/amdgpu_vram_mgr.h
index 4b267bf1c5db..9a2db87186c7 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_vram_mgr.h
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_vram_mgr.h
@@ -53,6 +53,33 @@  static inline u64 amdgpu_vram_mgr_block_size(struct drm_buddy_block *block)
 	return PAGE_SIZE << drm_buddy_block_order(block);
 }
 
+static inline struct drm_buddy_block *
+amdgpu_vram_mgr_first_block(struct list_head *list)
+{
+	return list_first_entry_or_null(list, struct drm_buddy_block, link);
+}
+
+static inline bool amdgpu_is_vram_mgr_blocks_contiguous(struct list_head *head)
+{
+	struct drm_buddy_block *block;
+	u64 start, size;
+
+	block = amdgpu_vram_mgr_first_block(head);
+	if (!block)
+		return false;
+
+	while (head != block->link.next) {
+		start = amdgpu_vram_mgr_block_start(block);
+		size = amdgpu_vram_mgr_block_size(block);
+
+		block = list_entry(block->link.next, struct drm_buddy_block, link);
+		if (start + size != amdgpu_vram_mgr_block_start(block))
+			return false;
+	}
+
+	return true;
+}
+
 static inline struct amdgpu_vram_mgr_resource *
 to_amdgpu_vram_mgr_resource(struct ttm_resource *res)
 {